[Mapserver-users] transparent background raster (tif)

Rosangela Silva rosangela.silva at zenitpolar.com.br
Tue May 27 16:07:16 EDT 2003


Thanks all for help.
Ed, your solution works, but the resultant image isn't
colorful, it is in gray scale, why?
Can I specify 2 or more OFFSITE values ??
Thanks
Rosângela

ps.: I have support for GDAL.

MapServer version 3.6.5 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=PROJ
SUPPORT
S=TTF SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT INPUT=JPEG INPUT=POSTGIS
INPUT=OGR
 INPUT=GDAL INPUT=SHAPEFILE

----- Original Message ----- 
From: "Ed McNierney" <ed at topozone.com>
To: "Rosangela Silva" <rosangela.silva at zenitpolar.com.br>;
<mapserver-users at lists.gis.umn.edu>
Sent: Tuesday, May 27, 2003 4:41 PM
Subject: RE: [Mapserver-users] transparent background raster (tif)


Rosangela -

Thanks - that's very helpful.  However, you will have a problem if you have
pixels that represent valid data AND pixels you want to be transparent, and
they both have the same pixel value.  How will MapServer (or a human <g>)
tell the difference?

In your situation, you would use the OFFSITE statement to identify the pixel
value you would like to make transparent.  You need to classify that raster
layer by having a CLASS statement in it, but you don't have to define any
classes.

I will assume that your black pixels have a value of 0 - in that case, you
would define the layer like this:

LAYER
  NAME "sp250"
  TILEINDEX "teste/sp250.shp"
  TILEITEM "IMAGE"
  STATUS DEFAULT
  TYPE RASTER
  OFFSITE 0 # Replace with whatever value the black pixel has
  CLASS
  END
END

This should display the layer properly in MapServer 3.x.  You will need to
have MapServer built with GDAL to handle TIFF input data, rather than the
"built-in" TIFF support.

- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242

-----Original Message-----
From: Rosangela Silva [mailto:rosangela.silva at zenitpolar.com.br]
Sent: Tuesday, May 27, 2003 3:14 PM
To: mapserver-users at lists.gis.umn.edu
Subject: Fw: [Mapserver-users] transparent background raster (tif)


 Hi,
 My images are 8-bit TIFF, and they are peaces of sattelite
 images (Landsat - RGB composit).
 Part of these images has valid information,
 but another part is complemented with deep black color.
 I think that I couldn't specify a black collor pixel (0)
 like "transparent" because some lakes and rivers are black too.
 I'd like to show only the valid information.
 I'll try to send a tiff like an example.
 Thanks
 Rosângela

> ----- Original Message ----- 
> From: "Frank Warmerdam" <warmerdam at pobox.com>
> To: "Rosangela Silva" <rosangela.silva at zenitpolar.com.br>
> Cc: "Mapserver-Users at Lists. Gis. Umn. Edu"
> <mapserver-users at lists.gis.umn.edu>
> Sent: Tuesday, May 27, 2003 3:27 PM
> Subject: Re: Fw: [Mapserver-users] transparent background raster (tif)
>
>
> > Rosangela Silva wrote:
> > >  Hello,
> > >
> > >  I'm using mapserver 3.6.5.
> > >  I don't know how the mapserver interprets the background of the
> > >  tiff or jpg images. I'm looking for information about it, and some
> > >  softwares assumes the transparent background like a cannel "alpha",
> > >  but I don't know exactly how it works.
> > >  Sorry, but, for while, it is everything I know to explain.
> >
> > Rosângela,
> >
> > How it is accomplished will, as Ed suggests, depend on the nature of the
> > image.  MapServer 3.6.5 (if using GDAL for raster IO) will support
> treating
> > pixels with "alpha=0" as transparent if the image is RGBA.  If the image
> is
> > in a format that returns a "nodata" value, or knows that particular
color
> > indexes in a paletted image are transparent, they will be automatically
> > treated as transparent.  3.6.x does *not* support the user indicating a
> > particular RGB value as transparent for 24bit inputs, but the OFFSITE
> value
> > can be used to mark one raw pixel value for greyscale or paletted images
> > that should be treated as transparent.
> >
> > I hope this helps.
> >
> > Best regards,
> >
> > -- 
>
> ---------------------------------------+----------------------------------
> ----
> > I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> > light and sound - activate the windows | http://pobox.com/~warmerdam
> > and watch the world go round - Rush    | Geospatial Programmer for Rent
> >
> >
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >
>

_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list