[Mapserver-users] Problems drawing JPEG Raster with Transparency

Jason M. Nielsen jnielsen at aero-graphics.com
Mon May 3 15:53:08 EDT 2004


Quoting Richard Gould <rgould at refractions.net>:

> So I have this JPEG layer that I wish to draw on top of a couple other 
> Shapefile layers, and I want it to be translucent. So in the mapfile I 
> have set:
> OFFSITE 255 255 255
> 
> And everything I want to be transparent is set to white (255, 255, 255).
> 
> However, when the layers are rendered and drawn, all the borders around 
> the non-transparent parts of the raster are surrounded by a near-white 
> (252, 252, 252) border.
> 
> You can see what I mean at: http://gislab-60.unbc.ca/viewer/out/problem.png
> The grey layers are shapefiles, the greenish-white layer is my JPEG raster.
> 
> Does anyone have any idea how to solve this problem?
> 
> Thanks,
> 
> Richard

I think the issue you are running into is where the pixels you expect to be 255
are actually slightly off due to the compression of JPEG. I would try with tiff
and see if the samething happens. If not then thats more than likely your
problem. How to get around it though... That I dont know. Maybe you can
eliminate it with the FORMATOPTION "QUALITY=80" or some number over the default
so it wont mess with that solid color. I wonder if you could reclassify that
image as well. ie: Tell it to classify certain pixels as 255 255 255 and do this
for a range of them. Perhaps then they would become that and hence transparent.
Of course I have no idea when and where this all takes place so even if that is
possible it may be of no use. Or I could just be totally off in left field and
this has no application to the situation.



More information about the mapserver-users mailing list