question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception reading a CMYK Jpeg

See original GitHub issue
What steps will reproduce the problem?
1. Generate a CMYK JPG, call it selectedFile
1. Run Thumbnails.of(selectedFile).size(500, 500).toFile(thumb500File);

What is the expected output? What do you see instead?

Expected output - thumb500File created normally

Actual output: Exception raised "Incompatible color conversion"

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?

OpenJDK 7u9, Ubuntu Linux

Please provide any additional information below.

The core Java method ImageIO.read produces exactly the same exception, e.g.

BufferedImage originalImage = ImageIO.read(selectedFile);

so it looks like the issue is with Java, however other people have found 
workarounds - 
http://www.randelshofer.ch/blog/2011/08/reading-cmyk-jpeg-images-with-java-image
io/

Would it be possible to implement a workaround in Thumbnailator too? I think 
the Java issue dates back some time.

A sample JPG exhibiting the problem is attached.

Original issue reported on code.google.com by oliver.k...@gmail.com on 1 Nov 2012 at 12:59

Attachments:

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
GoogleCodeExportercommented, Jul 25, 2015
Note
------
Use of "TwelveMonkeys ImageIO" fixes this particular issue.
https://github.com/haraldk/TwelveMonkeys

(Thank you for the tip, marcus!)

Original comment by coobird...@gmail.com on 21 Sep 2014 at 10:41

0reactions
coobirdcommented, Mar 12, 2022

Support for CMYK JPEGs would require writing a JPEG reader that supports it, which is outside the scope of Thumbnailator. (Thumbnailator is a wrapper around the Java 2D and Image I/O APIs.)

TwelveMonkeys ImageIO provides an excellent alternative to Java’s default JPEG reader/writer, which can deal with CMYK JPEGs

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading CMYK jpeg images - Adobe Support Community
I gave up using ColdFusion-related image functions. I've still identified CMYK images that can't consistently be read by ColdFusion 10.
Read more >
Unsupported image type?ImageIO can't read CMYK-encoded ...
Read a CMYK image into RGB BufferedImage. ... getImageReadersByFormatName("JPEG"); ImageReader reader = null; while(readers.
Read more >
How can I tell if a JPEG is RGB or CMYK? - Quora
As a user, you can tell in a Mac with File->Get Info. Or you can open the file in Photoshop and look at...
Read more >
Reading CMYK JPEG images with Java ImageIO - Randelshofer
Read an image with ImageIO.Unfortunately, the ImageIO.read method is not a reliable way for reading a JPEG CMYK image. ImageIO.read(file);. This ...
Read more >
To preview the CMYK image with inverted color — oracle-tech
But the Jpeg image can be previewed with inverted color if the image is in CMYK color mode. The preview is wokring correctly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found