[GRASS-dev] Re: [GRASS GIS] #967: r.out.png: respect TRANSPARENT and
COMPRESSION enviro vars
GRASS GIS
trac at osgeo.org
Sat Feb 27 16:04:51 EST 2010
#967: r.out.png: respect TRANSPARENT and COMPRESSION enviro vars
--------------------------+-------------------------------------------------
Reporter: hamish | Owner: grass-dev at lists.osgeo.org
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.out.png
Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by glynn):
Replying to [comment:2 hamish]:
> patch attached to add transparency, compression, and background color
options to r.out.png. Patch is vs 6.5svn.
>
> * I'm not sure how useful bgcolor= is, as I'm not sure how often "set"
is likely to return no-color from G_lookup_raster_colors(), or really what
triggers that to be set==0. Or should bgcolor= override the color table's
"nv" color for NULL cells when there's no alpha channel? Is "set" like the
default("*") lesser used rule in the color tables?
r.out.png shouldn't write the background colour into the image data; it
should just pass it to png_set_background(). If the image has an alpha
channel or transparent colour index but the reader wants an opaque image,
the PNG library overlays the image on the background colour.
The "set" value is 0 if the default colour was used, 1 if a colour was
found for the cell's value (including null; the null value colour is
always defined).
If you want to write an RGB image (no alpha), ignore the "set" value and
the bgcolor= option, and just write exactly what G_lookup_raster_colors()
returns.
If you want to also write an alpha channel, there are two independent
options: whether to make null cells transparent and whether to write cells
with no defined colour (set == 0) as transparent. In all cases, the RGB
channels should still contain exactly what G_lookup_raster_colors()
returns.
> * the pointer for G_is_null_value() is specified in a rather raw way.
Ideas for improvement are welcome.
Arithmetic on a void pointer is undefined (gcc supports it as an
extension). Use:
{{{
size_t rsize = G_raster_size(rtype);
...
G_incr_void_ptr(voidc, col * rsize);
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/967#comment:3>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list