I suspect the solution here is probably really simple, but I’m stumped…
// Create the buffered image. BufferedImage bufferedImage = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB); // fill image data (works fine) ImageIO.write(bufferedImage, 'JPG', f1); // works fine ImageIO.write(bufferedImage, 'PNG', f2); // works fine ImageIO.write(bufferedImage, 'GIF', f3); // this returns false, creates a broken gif file, but fires no exceptions
Does ImageIO.write() not work for gifs? is this some sort of throwback to gif being a proprietary Compuserve thing? Or am I just being stupid (I’m guessing it’s the last one 🙂 )
http://java.sun.com/javase/6/docs/api/javax/imageio/package-summary.html#gif_plugin_notes
Note that GIF can only store 256 colors.