Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8180746

some image turns red after ImageIO.write(buf, "jpg", file)

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+170)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+170, mixed mode)

      jdk 8 also has the same problem
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]
      win7 x64

      A DESCRIPTION OF THE PROBLEM :
      some image turns red after ImageIO.write(buf, "jpg", file)

      the java code is simple

      BufferedImage buf = ImageIO.read(new File("l:/before.png"));
      ImageIO.write(buf, "jpg", new File("l:/after.jpg"));

      see the image files in attachements

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the new image should not looks red.
      ACTUAL -
      the new image looks red.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------


      import javax.imageio.ImageIO;
      import java.awt.image.BufferedImage;
      import java.io.File;
      import java.io.IOException;

      public class T{

      public static void main(String[] args) throws IOException {
      BufferedImage buf = ImageIO.read(new File("l:/before.png"));
      ImageIO.write(buf, "jpg", new File("l:/after.jpg"));
      }
      }
      ---------- END SOURCE ----------

        1. before.png
          before.png
          5 kB
        2. T.java
          0.3 kB

            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: