0

I'm trying to write a BufferedImage to a TIFF file using ImageIO, but it is always returning false. According to the documentation:

Returns: false if no appropriate writer is found.

There are no problems writing to PNG or JPG formats. I saw somewhere that it might have to do with RGB vs ARGB, but neither case works. What does it mean that "no appropriate writer is found"? Any help would be appreciated! (Using v1.8.0_121)

        try
        {
            BufferedImage arbgBI = new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB);
            System.err.println("PNG: " + ImageIO.write(arbgBI, "png", new File("arbgBI.png")));
            System.err.println("JPG: " + ImageIO.write(arbgBI, "jpg", new File("arbgBI.jpg")));
            System.err.println("TIFF: " + ImageIO.write(arbgBI, "tiff", new File("arbgBI.tiff")));

            BufferedImage rbgBI = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
            System.err.println("PNG: " + ImageIO.write(rbgBI, "png", new File("rbgBI.png")));
            System.err.println("JPG: " + ImageIO.write(rbgBI, "jpg", new File("rbgBI.jpg")));
            System.err.println("TIFF: " + ImageIO.write(rbgBI, "tiff", new File("rbgBI.tiff")));                
        }
        catch (Exception ex) { System.err.println(ex); }

The output is:

PNG: true
JPG: true
TIFF: false
PNG: true
JPG: true
TIFF: false
cdubbs
  • 97
  • 12

0 Answers0