I am writing out GeoTiffs and am trying to embed a colormap within them. It is not obvious to me how to do this using Geotools. I am starting with a GridCoverage2D and using a GeoTiffWriter.
On Mon, Aug 5, 2013 at 9:04 PM, Paige M. Baldassaro <
> I am writing out GeoTiffs and am trying to embed a colormap within them.
> It is not obvious to me how to do this using Geotools. I am starting with a
> GridCoverage2D and using a GeoTiffWriter.
The writer won't do it for you, the image itself should start with a
If you have a RGB image to start with, you can use the CustomPaletteBuilder
to turn it into
a indexed one, something like:
CustomPaletteBuilder cpb=new CustomPaletteBuilder(image,
256, subsx, subsy, 1).buildPalette();
image = cpb.getIndexedImage();
If instead you start with a RGBA one and want to preserve the alpha channel
GeoServer has a
Quantizer class in the wms module that can be use to produce a palette with
but mind, that code is currently under the GPL licence (I wrote it, and
might port it back to
GeoTools changing the license, it's just that mostly have no reason to do
so right now).
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
Ing. Andrea Aime
Via Poggio alle Viti 1187
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
Get latest updates about Open Source Projects, Conferences and News.