[
https://issues.apache.org/jira/browse/IMAGING-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17222702#comment-17222702
]
Bruno P. Kinoshita commented on IMAGING-270:
--------------------------------------------
The image is using YCCK, but `Imaging.getBufferedImage(filecontents);` only
looks at the number of components. When it finds 4, it tries to do a CMYK to
RGB conversion. The resulting image has that dark/negative effect.
I think if we inspected the image info, checking if it's YCCK, converting to
CMYK, and then to RGB, it should improve.
However, it also has Adobe segments with color profile data. I think we will
need to combine those segments to create a color profile, to filter the data
and produce/correct the final colors in the image. Also, it may require some
more converting/inverting the data (need to check the JPEG docs/books about
CMYK/YCCK).
I will take a look what would be necessary to change in JpegImageParser or
JpegDecoder to properly convert the color type.
> CMYK jpg file is not supported
> ------------------------------
>
> Key: IMAGING-270
> URL: https://issues.apache.org/jira/browse/IMAGING-270
> Project: Commons Imaging
> Issue Type: Bug
> Affects Versions: 1.0-alpha2
> Environment: Jave 8, WIN7 64bits, Eclipse JEE 2020-03
> Reporter: Yi SONG
> Priority: Minor
> Attachments: Channel_digital_image_CMYK_color.jpg
>
>
> Hi,
> It seems that the attached cmyk jpg file is not supported. after writing back
> to jpg, it becomes black.
> read:
> bufferedImage = Imaging.getBufferedImage(filecontents);
> filecontents is the path to the image file.
> write:
> ByteArrayOutputStream bos = new ByteArrayOutputStream();
> ImageIO.write(bufferedImage, "jpg", bos);
> byte[] result = bos.toByteArray();
> System.out.println(result.length);
> ImageIO.write(bufferedImage, "JPG", outFile);
--
This message was sent by Atlassian Jira
(v8.3.4#803005)