[GRASSLIST:4605] Re: Transparent null values in output images.

Gordon Keith gordon.keith at csiro.au
Thu Oct 21 17:50:22 EDT 2004


On Wed, 20 Oct 2004 23:01, Hamish wrote:
> > I have some rasters with large null areas.
> >
> > I would like to output these as images (r.out.png or r.out.tiff) with
> > the null values represented by transparent pixels.
> >
> > I can't see any flags on these commands to enable this.
> >
> > Is this possible?
>
> some clues:
>
> set $GRASS_TRANSPARENT to "TRUE"
>   then d.out.png (or d.mon start=PNG etc)
>
> Set $GRASS_WIDTH & $GRASS_HEIGHT to region settings for cols & rows to
> get 1:1 scaling (as with r.out.png).
>
>
> d.out.png then merge alpha in the GIMP?
> r.out.ppm -> gimp?

If I'm going to have to resort to GIMP it's probably easier just to use 
r.out.png then GIMP:
Edit - Layers - Add alpha channel
Edit - Select - by colour - click on white
Edit - Cut (Ctrl-X)
File - Save

But it does look like

r.out.ppm raster
pnmtopng  -transparent white raster.ppm > raster.png

does the job nicely.

Thanks for pointing me in the right direction.

Thought: is it worth mentioning this in the r.out.ppm man page?

Regards
Gordon


-- 

Gordon Keith
Programmer/Data Analyst
Marine Acoustics
CSIRO Marine Research
http://www.marine.csiro.au

To mess up a Linux box, you need to work at it;
to mess up your Windows box, you just need to work on it.
 - Scott Granneman, SecurityFocus




More information about the grass-user mailing list