[GRASS-user] display image (photo / jpeg) with PNG driver (i.e. add logo to map).

Glynn Clements glynn at gclements.plus.com
Wed Sep 2 16:56:25 EDT 2009


Tim Holland wrote:

> I would like to add a logo to a map that I am printing with the PNG driver. 
> It is a .jpg, although I could switch it to another image type if that was
> helpful.  Is there any way to do that?

Import it as 3 raster maps (red, green, and blue channels) with
r.in.gdal, move the maps to the correct size and location with
r.region, then display them with d.rgb.

This may produce resampling artifacts. Display modules such as d.rgb
will have the input maps resampled to the current region, and will
then resample them to the display resolution.

Setting the current region bounds and resolution to match the display
pixel grid will eliminate one resampling step. Using "r.region -c ..." 
to match the raster to the current region will eliminate the other.

Alternatively, if you have the PNG driver generate PPM output (e.g. 
GRASS_PNGFILE=map.ppm), you can use g.pnmcomp to composite multiple
PPM/PGM images (all images need to have the same dimensions, and each
PPM file needs a corresponding PGM file containing the alpha channel).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list