On Feb 24, 2004, at 5:50 PM, Martijn Houtman wrote:
In JAI there is a bug when a transparent gif is converted to jpeg (happens probably with other formats too). I solved the bug in convertJAI.java by changing the image to RGB mode when necessary.
�
������� if (! (format.equals("gif") || format.equals("png")) &&
����������� img.getColorModel()instanceof IndexColorModel) {
��������� IndexColorModel icm = (IndexColorModel) img.getColorModel();
��������� if (icm.getTransparency() == Transparency.BITMASK) {
����������� byte[][] data = new byte[3][icm.getMapSize()];
����������� icm.getReds(data[0]);
����������� icm.getGreens(data[1]);
����������� icm.getBlues(data[2]);
����������� LookupTableJAI lut = new LookupTableJAI(data);
����������� img = JAI.create("lookup", img, lut);
����������� log.debug("palette-color image converted to RGB");
��������� }
������� }
�
I added also a gif encoder to convertJAI.java, so now JAI works well with gif's. Because I am not able to change the MMBase code I will send everything to Daniel Ockeloen, who is the author of convertJAI.java.
�
Martijn Houtman
�
�
Thats fine, please send it soon since it can then make rc3 (this is a bugfix so), best will be the whole file so i don't have to integrate it myself.
Thanks for the fix,
Daniel.
