Simone Giannecchini ha scritto:
Hi lists, I am about to commit to the 1.5.x branch some changes I
made over the last few days in order to boost support for fixed
palettes aka inversion of colour map. For whom is interested this
allows to specify a palette to use when performing the colour
quantization mechanism which result in faster quantization since we
do not have to create a (near)optimal palette on the fly.
Hi Simone,
just tried it out, sorry for the delay. Now, with the untiled map
preview, it works very well... I tried states, the new sample
map group tiger-ny and with the new spearfish dataset all against
the safe palette, which is not optimized in any way, yet the result
was quite good looking and quick to get on the screen
(well, the spearfish demo has a DEM in
the background, that one jumped from one color to another, but
that's to be expected, one should either not use paletted images
for raster data, or create a carefully crafted palette).
Images are a lot smaller, as expected. For example:
http://localhost:8080/geoserver/wms?HEIGHT=317&WIDTH=800
&LAYERS=topp%3Astates&STYLES=&SRS=EPSG%3A4326&FORMAT=image%2Fpng
&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap
&EXCEPTIONS=application%2Fvnd.ogc.se_inimage
&BBOX=-122.655615%2C30.121339%2C-73.016764%2C49.790734
-> 800x316 pixels, 58.73kb
http://localhost:8080/geoserver/wms?HEIGHT=317&WIDTH=800
&LAYERS=topp%3Astates&STYLES=&SRS=EPSG%3A4326&FORMAT=image%2Fpng
&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap
&EXCEPTIONS=application%2Fvnd.ogc.se_inimage
&BBOX=-122.655615%2C30.121339%2C-73.016764%2C49.790734&PALETTE=safe
-> 800x317 pixels, 17.95kb
Now, that's a neat gain. (in this particular image the paletted
version colors are visibly lighter, but that's simply because the
actual color used in the SLD have no match in the internet
safe palette).
Which makes me think... you added support for the Paint Shop
Pro palette format. Have you seen any palette collection around the
net that we could add to Geoserver? I'm sure I've seen some, maybe
for other programs, but cannot find them anymore. I think it would
be a nice addition, especially if we could visualize them in a
sort of preview page.
And now the sad notes: the standard tiled preview is broken.
The error follows:
...
Caused by: java.lang.ClassCastException: javax.media.jai.RenderedOp
cannot be cast to java.awt.image.BufferedImage
at
org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.forceIndexed8Bitmask(DefaultRasterMapProducer.java:334)
at
org.vfny.geoserver.wms.responses.map.png.PNGMapProducer.formatImageOutputStream(PNGMapProducer.java:66)
at
org.vfny.geoserver.wms.responses.map.metatile.MetatileMapProducer.writeTo(MetatileMapProducer.java:215)
at
org.vfny.geoserver.wms.responses.GetMapResponse.writeTo(GetMapResponse.java:496)
at
org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:592)
... 27 more
I looked a bit in the code, it would be possible to perform
palette inversion anyways but apparently the code would have to
be tile oriented, since RenderedImage provides you a copy-less
access to its Raster only if you access it tile by tile.
Thoughts?
Cheers
Andrea