GeoWebCache / geowebcache

GeoWebCache is a tile caching server implemented in Java that provides various tile caching services like WMS-C, TMS, WMTS, Google Maps, MS Bing and more
https://www.geowebcache.org
343 stars 281 forks source link

Support for semi-transparant png8 requested #48

Open robstek opened 13 years ago

robstek commented 13 years ago

We would like to see proper realization of png8 semi-transparent images.

JAI handles fully transparant images, but not semi-transparant properly.

The only program we know that does a proper conversion from png to png8, is the external program pngquant.

GeoWebCache commented 13 years ago

sorry for the slow turn around. Would you explain a bit more how is it that JAI doesn't handle semi-transparent images properly, and what is exactly that we need to achieve for this issue? Is it about reading semi-transparent png8 from the WMS servers or about storing tiles as semi-transparent png8? My fear is that we're just not using JAI properly for that case, like in needing to first convert the rendered images to an indexed color model or so. Is it possible to generate the kind of image you need with geoserver? cause if so, that'd be an indication that we're just not using JAI properly.

GeoWebCache commented 13 years ago

update: after some investigation (not really my field of expertise, if I ever had one) it looks like what we need to support encoding of semi-transparent png images out of an RGBA one is applying the NEUQUANT quantizer (http://members.ozemail.com.au/~dekker/NEUQUANT.HTML) to create the indexed image.

Fortunately it looks like JAI supports it, it's just not the default: http://download.oracle.com/docs/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ColorQuantizerDescriptor.html

So it looks it's a bit slower than the default median cut quantization algorithm, but since we're creating tiles to be stored on disk and then served up directly it shouldn't matter, right?

GeoWebCache commented 13 years ago

update2: "This operation generates an optimal lookup table (LUT) based on the provided 3-band RGB source image by executing a color quantization algorithm." The op won't work on RGBA images as far as I know. Thanks aaime. The Java implementation at http://members.ozemail.com.au/~dekker/NEUQUANT.HTML may still bring some hope.