ImageIO not able to write a JPEG file

后端 未结 5 1581
萌比男神i
萌比男神i 2020-12-01 06:16

I have a BufferedImage I\'m trying to write to a jpeg file, but my Java program throws an exception. I\'m able to successfully save the same buffer to a gif and png. I\'ve t

5条回答
  •  隐瞒了意图╮
    2020-12-01 06:30

    You get the same error

    Caused by: javax.imageio.IIOException: Invalid argument to native writeImage
    at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
    at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1055)
    

    if you are using a not supported Color Space (in my case CYMK). See How to convert from CMYK to RGB in Java correctly? how to solve this.

提交回复
热议问题