Norman Geyer created IMAGING-372:
------------------------------------

             Summary: Wrong colors while reading JPEG and converting to BMP
                 Key: IMAGING-372
                 URL: https://issues.apache.org/jira/browse/IMAGING-372
             Project: Commons Imaging
          Issue Type: Bug
          Components: imaging.*
    Affects Versions: 1.0-alpha3
         Environment: Tested with Java 1.8.0_281 on Windows 10 Professional
            Reporter: Norman Geyer
             Fix For: Patch Needed
         Attachments: 25606_200x200.jpg, 25606_200x200.jpg.bmp, 91691-01.jpg, 
91691-01.jpg.bmp

Hi. I am reading JPEG image file and using this library to convert it to BMP 
format. Resultant bitmap file has wrong color comparing to original file. Below 
is the code :

 
{code:java}
    ArrayList<File> files = new ArrayList<File>();
    files.add(new File("./files/25606_200x200.jpg"));
    files.add(new File("./files/91691-01.jpg"));
    for (File file : files)    
    {
      try
      {
        //File trgFile = ImageConverter.convert(file, "bmp");
        final BufferedImage bi = Imaging.getBufferedImage(file);        final 
File dstFile = new File(file .getAbsolutePath() + ".bmp");        
Imaging.writeImage(bi, dstFile, ImageFormats.BMP);        
System.out.println(dstFile.getName() + " has been converted successfully.");    
    
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }        
    }{code}
 

Image "25606_200x200.jpg.bmp" has the wrong color depth,  image 
"91691-01.jpg.bmp" has the right color depth but wrong color mapping (maybe the 
embedded ICC-Profile is the cause here).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to