0

While using the code (java) :

try {
    ImageIO.write(image, "jpg",new File("outMYFILE.jpg"));
} catch (IOException g) {
    g.printStackTrace();
}

The image that is save changes its colors and for example instead of black image there is a blue one. How can I fix this? Thanks.

4J41
  • 5,005
  • 1
  • 29
  • 41
  • Do you have the same result if you try the png format? – Stijn Geukens Mar 17 '14 at 14:07
  • are you watching the saved image on the same device/monitor? Also note that jpeg is not a lossless format. – HectorLector Mar 17 '14 at 14:09
  • 1
    [problem using ImageIO.write jpg file](http://stackoverflow.com/questions/4386446/problem-using-imageio-write-jpg-file) and [this](http://stackoverflow.com/a/4388542/1611791) – 4J41 Mar 17 '14 at 14:21
  • The color profile is most likely corrupted or something is missing. Are you creating the image as in a drawing, or are you getting it from a URL? – Daniel B Mar 17 '14 at 14:23
  • Please update the question with a before/after file, along with extra information about `image` (type, color model, etc) and Java version (runtime). If this happens for all your images, I'd say your JRE is broken, but I assume it only happens for a very few images? Does your image contain transparency? – Harald K Mar 17 '14 at 16:40

0 Answers0