[mapserver-users] Quantize and 8bit/1bit PNG problem

Dan Little danlittle at yahoo.com
Mon Nov 2 10:04:25 EST 2009


You could use a Python/PHP mapscript wrapper that tests to see the number of colors in the PNG before returning it to the client.  In such a case you could manipulate the PNG using GD/PAL/Cairo/Graphics-Library-of-the-Month.


----- Original Message ----
> From: Frank Warmerdam <warmerdam at pobox.com>
> To: paalkr <pal.kristensen at statkart.no>
> Cc: mapserver-users at lists.osgeo.org
> Sent: Mon, November 2, 2009 8:59:13 AM
> Subject: Re: [mapserver-users] Quantize and 8bit/1bit PNG problem
> 
> paalkr wrote:
> > Hi!
> > 
> > Could I please ask for a comment on this issue from one of the developers?
> 
> Pål,
> 
> One bit PNGs are a perfectly valid response.   I would suggest
> two approaches.
> 
> 1) File a ticket with Microsoft on Bing Maps, and hopefully they will
> roll a fix into their operational build within a couple days.  (ha ha)
> 
> 2) Manually produce a nice empty tile that works with Bing Maps some
> other way, and write a script to replace the 1bit PNG file (which should
> presumably have a fixed size) with the bing-safe ones.
> 
> Perhaps not the sort of answer you were hoping for, but you did
> implore us for comment even when none of us thought we had anything
> particularly bright to say.
> 
> Best regards,
> 
> > paalkr wrote:
> >> Hi!
> >>
> >> I have the following output format defined in my mapfile (MapServer
> >> 5.4.2):
> >>
> >>    OUTPUTFORMAT
> >>       NAME "png8bit"
> >>       DRIVER "AGG/PNG"
> >>       MIMETYPE "image/png"
> >>       EXTENSION "png"
> >>       FORMATOPTION "QUANTIZE_FORCE=ON"
> >>       FORMATOPTION "QUANTIZE_COLORS=256"
> >>       FORMATOPTION "QUANTIZE_NEW=ON"
> >>       FORMATOPTION INTERLACE=OFF
> >>    END
> >>
> >> This works very well most of the time, even transparency. But in
> >> situations where the GetMap request don't contain any data at all
> >> (returned image should be total transparent) the resulting PNG is 1bit in
> >> stead of 8bits. If the produced image does contain some data the produced
> >> image i 8bits, with correctly rendered transparency where there are no
> >> data.
> >>
> >> This behavior are specially troublesome when building a tile cache because
> >> there are a lot of this request without any valid data. In almost all
> >> applications I guess that this issue wouldn't do any harm, but we uses
> >> Bing Maps for some projects and Bing Maps can't handle 1bit PNGs.
> >>
> >> What can be done to overcome this issue? 
> 
> 
> -- 
> ---------------------------------------+--------------------------------------
> 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.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users



      


More information about the mapserver-users mailing list