我怀疑这里的解决方案可能真的很简单,但我很难过......
// 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
ImageIO.write()
不适用于 GIF ?这是某种对 gif 作为专有 Compuserve 事物的回归吗?还是我只是愚蠢(我猜这是最后一个:))