Convert CMYK to RGB

Enonic version: 7.1.3
OS: Ubuntu 14.04.5

I’m currently working on a project where we have a task used for importing products from a given PIM API, which returns data in the JSON format. Among the attributes provided for each product, we have the product image, where we’re provided with the URL of the image. Most products work just fine, however we noticed some of the products do not have the images being created in Enonic.

When investigating the problem, we’ve found out that such images are not being created because they’re using the CMYK color model, while Enonic only accepts RGB. The images open just fine in the browser, but even if we download and manually upload the file to Enonic, it won’t be rendered due to the CMYK color model.

Our team has quickly converted one image to RGB using Python, as a test, and the image is then correctly rendered in Enonic.

I wonder if anyone out there knows any way out for converting these images from CMYK to RGB, while executing our code? Just wanted to check this before spending too much time on approaches that would lead us nowhere. Perhaps it could be possible to fetch images from the API, convert it in JAVA and then use it Enonic? Any thoughts?

Thanks.

1 Like

I don’t have a solution, but I’m subscribing to this thread since it’s something I’ve wanted to do for a while.
Another similar issue I’ve read reports about is people uploading images into Enonic that use Grayscale color space instead of 24-bit RGB color. This almost works, except that the grayscale curve is converted very crudely so the midtones in the image may appear darker or brighter than the original.

I suppose there may be online APIs that do this, with bandwidth limitations of course. But I think a better solution is probably to find a Java Library that does this, and then write some Java code that can be invoked in your JavaScript controller using the Java Bridge: https://developer.enonic.com/docs/xp/stable/framework/java-bridge

1 Like

It should be possible to add CMYK support natively to XP by including the TwelveMonkeys library.

2 Likes