B
babz
Java does not allow us to use more than 16 entries in the color map of
the Index Color Model for palette mode PNG encoding.
This disrupts the quality of images drastically. Is there a way to
improve the image quality?
This is the code I used:
int cmap[] = {
0x00000000,
0xFF202020,
0xFF0000FF,
0xFF808080,
0xFF00FF00,
0xFF00FFFF,
0xFFFF0000,
0xFFFF00FF,
0xFFFFFF00,
0xFFFFFFFF,
};
IndexColorModel colorModel = new IndexColorModel(8,
cmap.length, cmap, 0, true, -1,
DataBuffer.TYPE_BYTE);
bufImg = new BufferedImage(width, height,
BufferedImage.TYPE_BYTE_INDEXED, colorModel);
Thanks,
Babz
the Index Color Model for palette mode PNG encoding.
This disrupts the quality of images drastically. Is there a way to
improve the image quality?
This is the code I used:
int cmap[] = {
0x00000000,
0xFF202020,
0xFF0000FF,
0xFF808080,
0xFF00FF00,
0xFF00FFFF,
0xFFFF0000,
0xFFFF00FF,
0xFFFFFF00,
0xFFFFFFFF,
};
IndexColorModel colorModel = new IndexColorModel(8,
cmap.length, cmap, 0, true, -1,
DataBuffer.TYPE_BYTE);
bufImg = new BufferedImage(width, height,
BufferedImage.TYPE_BYTE_INDEXED, colorModel);
Thanks,
Babz