I have the following problem: I load an animated gif, and convert it to DirectColorModel When I am done with it, I convert it back to IndexColorModel, I convert the colormodel by creating a lookup table, for the first frame, and then store the colormodel for the other frames and convert them in the following manner:
ColorModel cm = params.getInternalVariables().getCm(); BufferedImage newImage = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_BYTE_INDEXED,(IndexColorModel)cm); Graphics2D gfx = newImage.createGraphics(); gfx.drawImage(image,0,0,null); The problem is that if i have an image with a transparent background, lets say black (rgb 0,0,0) and the image also contains some colors close to this, lets say rgb 10,0,10 then the resulting image will have its solid black background changed to a mix of rgb 0,0,0 and 10,0,10. The result being that since 0,0,0 is the transparent color, the 10,0,10 pixels come out as black dots which ruins the image. If I do the full conversion for each frame of the animation then this will not happen, but creating the lookup table is so unbelievably slow, like 10 seconds for a small gif, so the time to process the image would increase by 10 seconds multiplied with the number of frames, that is not an option. Is there a way that I can prevent it from changing the solid black background to a variation of black tones? I know that if the image does not contain any colors close to the transparent color then it will work, but often this will be the case and if any colors resembling the transparent one if found when I run the above code, then I get the problem. I dont know if I am providing a clear eanough problem here, does anyone have any input to this? thanks [Message sent by forum member 'aryland' (aryland)] http://forums.java.net/jive/thread.jspa?messageID=119305 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".