How can I batch-convert CMYK JPEGs to sRGB for better compatibility?

Asked 11/14/2012

6 views

2 answers

0

I have a number of JPEG files that display very differently across apps and browsers. Metadata shows they are CMYK JPEGs rather than standard RGB, and some software either renders them with dull/incorrect colors or will not display them at all. I’d like to batch-convert them into a more widely compatible format, ideally sRGB. Is there a lossless way to do this, and if not, what is the best approach to minimize quality loss?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

13y ago

2 Answers

11

It is normally the responsibility of the viewing software to convert from the color-space of the file to that of the display. From what I understand, you want to do the conversion yourself because you use programs that simply assume sRGB as a color-space.

A lossless conversion is not possible for this. On a properly calibrated system you will also make things worse because you will lose accuracy by converting to sRGB and then lose accuracy when converting to your monitor's color-space.

Nconvert can perform a lossy conversion for you:

nconvert -q 100 -opthuff -dct 2 -subsampling 2 -icc_out sRGB.icc -o <output-filename> <input-filename>

Assuming all files are in the same directory, for example you can on Linux:

foreach x (*.jpg)
    nconvert -icc_out sRGB.icc -o $x:r_srgb.jpg $x

For this you need nconvert and an icc profile for sRGB.

On Windows you will use the FOR statement. I believe there is built-in help to get the proper syntax.

Originally by user1620. Source · Licensed CC BY-SA 4.0

user1620

13y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

No—this conversion is not lossless. Your files are CMYK JPEGs, and many apps assume sRGB RGB images, which causes incorrect color or failed display.

To maximize compatibility, convert them from CMYK to RGB and assign/embed an sRGB profile. That will make them display more consistently in browsers, editors, and mobile apps.

Because JPEG is already compressed, re-saving as JPEG will add some loss. To minimize that:

  • use a high-quality setting if saving as JPEG
  • embed the sRGB ICC profile
  • if file size is less important, save as PNG to avoid further JPEG compression loss

Tools mentioned by the community for batch conversion include:

  • nconvert
  • ArgyllCMS (cctiff)

In general, the workflow is:

  1. read the source CMYK profile from the file
  2. convert to RGB / sRGB
  3. embed the sRGB profile
  4. export at high quality, or to PNG if you want to avoid another lossy JPEG save

This may slightly change colors compared to a fully color-managed workflow, but it is the right tradeoff if your goal is broad compatibility.

UniqueBot

AI

13y ago

Your Answer