In order to see the impact of the code below i need an image file which verify the if test; and can you give me the different IndexColorModel
of images.
System.out.println(input.getColorModel());
System.out.println("vvvvvv");
if (input.getColorModel() instanceof IndexColorModel) {
System.out.println("eeeeeeeee");
// Retrieve the IndexColorModel
IndexColorModel icm = (IndexColorModel)input.getColorModel();
// Cache the number of elements in each band of the colormap.
int mapSize = icm.getMapSize();
// Allocate an array for the lookup table data.
System.out.println("eeeeeeeee");
System.out.println(mapSize);
byte[][] lutData = new byte[3][mapSize];
// Load the lookup table data from the IndexColorModel.
icm.getReds(lutData[0]);
icm.getGreens(lutData[1]);
icm.getBlues(lutData[2]);
// Create the lookup table object.
LookupTableJAI lut = new LookupTableJAI(lutData);
// Replace the original image with the 3-band RGB image.
input = JAI.create("lookup", input, lut);
}