// user provided palette?
if (mapContent.getPalette() != null) {
indexer = new CachingColorIndexer(new LRUColorIndexer(icm, 1024));
} else if (palettedFormatName.equalsIgnoreCase(format)) {
// build the palette and grab the optimized color indexer
indexer = new Quantizer(256).subsample().buildColorIndexer(image);
}
// if we have an indexer transform the image
if (indexer != null) {
image = ColorIndexerDescriptor.create(image, indexer, null);