[GRASS5] color in GRASS

Glynn Clements glynn.clements at virgin.net
Tue Mar 23 16:43:09 EST 2004


Michael Barton wrote:

> Somehow this is just not doing the trick--unless my eyes are deceiving 
> me.

Are you sure that your version of the PNG driver supports 24-bit
images? I.e. it either uses GD 2.x or is the GD-less version (i.e. 5.3
later than 2003-10-31)?

> The PNG driver is creating a 44Kb image of the display while xwd is 
> creating a 1.2 Mb image of the same display.

The PNG format compresses the image data using zlib; xwd doesn't use
compression.

> The differences in color are clearly apparent.

It's probably an 8-bit PNG, then.

> As a test, I am just looking at a greyscale 
> shaded relief map. Will this look paletted as a 24bit PNG?

No.

There isn't actually any need for it to look paletted as an 8-bit PNG
either. 8 bits gives 256 colours; 24 bits gives 256 levels per
component. For a grey-scale image, both are limited to 256 shades of
grey.

However, the display library (libdisplay) which d.rast uses is
somewhat less than optimal in the way in which it configures the
driver's colour table. In many cases, it simply allocates a colour
cube (up to 32x32x32 levels, although with a 256 colour driver, it's
limited to 6x6x6 = 216 colours). OTOH, it uses a special case when it
knows that the image is grey-scale.

> The image 
> created by xwd does not look paletted and closely matches the display 
> monitor image.

It very much appears that your PNG driver is only creating 8-bit
images.

When the driver is started with "d.mon start=PNG", does it print
either of:

	PNG: GRASS_TRUECOLOR status: TRUE
or:
	PNG: GRASS_TRUECOLOR status: FALSE

If it doesn't print either, it's the old GD-based driver, and it was
built with GD 1.x, which only supports 8-bit images.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list