Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-372

Wrong colors while reading JPEG and converting to BMP

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0-alpha3
    • Patch Needed
    • imaging.*
    • None
    • Tested with Java 1.8.0_281 on Windows 10 Professional

    Description

      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 :

       

          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();
            }        
          }

       

      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).

      Attachments

        1. 25606_200x200.jpg
          38 kB
          Norman Geyer
        2. 25606_200x200.jpg.bmp
          39 kB
          Norman Geyer
        3. 91691-01.jpg
          26 kB
          Norman Geyer
        4. 91691-01.jpg.bmp
          28 kB
          Norman Geyer

        Activity

          People

            Unassigned Unassigned
            norman.geyer Norman Geyer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: