2

TL;DR

I'm chasing a color problem that occurs for one of our images. That image appears in different green tones in different viewers.

The source image

enter image description here

Notes

  • Most image viewers will render it light green.

    • including Chrome, XnView
  • Some image viewers will render it dark green:

    • including Safari, Faststone Image Viewer
  • thus, depending on your browser the source image will appear to you light or dark green

The difference (hard-coded for illustration)

enter image description here

Note: The dark green color is the intended color tone.

The information I'm lacking

I understand that there must be a corruption of the color profile of the source image, or, there seems to be no Color profile set in the source image. However, some image tools display it correctly, making me believe there is a different "guess" on the profile.

  1. What are those image tools assuming so that it appears dark green?
  2. What is the correct term of the missing color profile: IPTC, XMP, ICC?
  3. on top of everything the source image are CMYK. Does that play a role? (I think, yes.)

The desired solution

I don't want to render it as CMYK in a browser. I actually want to process the source CMYK image to sRGB once and permanently. The created output I will save for delivery in a browser.

This conversion I want to do with gm. I tried gm convert input.jpg png:output.png but this persists the image with the wrong colors. I also played a lot with -profiles settings with no luck.

Question

Can I, with gm identify and/or gm convert, correct for the missing/corrupted color profile of the source and persist the correct color, which is dark green, by a better guess of the color profile?

Note

I cannot do that in a graphics software as this needs to be done on thousands of images.

Update: solution for me

convert -profile "U.S. Web Coated (SWOP) v2.icm" input.jpg -profile sRGB_v4_ICC_preference.icc out-27.png 

see here for more details.

4
  • 5
    Why are you using web browsers to check a CMYK image?? One should use RGB images for the web.
    – Scott
    Mar 6, 2023 at 21:30
  • are you sure any of the applications have color engine that is aware of cmyk profiles?
    – joojaa
    Mar 6, 2023 at 21:30
  • To @Scott: I don't do that. I want to convert to RGB. The notes on the browser were just hints. I want to permanently convert and correct for my color issue programmatically with gm. I updated my question.
    – agoldev
    Mar 14, 2023 at 14:43
  • I think the hurdle, at least here, is designers don't really use Graphics Majick as far as I know. Designers would most likely set a script or action in Photoshop to convert many images from CMYK to sRGB.
    – Scott
    Mar 15, 2023 at 17:17

2 Answers 2

4

I do not use command line converters. But you can actually use some image viewers to batch-convert thousands of images. The image viewer acts as a GUI for a transform engine.

I prepared a CMYK file with C100%+Y100%, saved as JPG CMYK mode. The first one with the Swop2 profile embedded and the second one without it.

Here is a screen capture of a lot of windows opened at the same time.

enter image description here

They come in pairs.

  • Top-left: Firefox CMYK on and off.
  • Top-right: Chrome CMYK on and off.
  • Bottom left: Irfan View on and off.
  • Bottom right: Firefox RGB after batch conversion by Irfanview.

Irfanview is very fast in batch conversion mode. It did a decent job guessing the intended tone of the cmyk file without a color profile.

Sorry, I don't know the specifics of the command line you are asking. But think on Irfanview as a GUI.


I will sound like an IrfanView evangelist. But you can batch process, rename, even batch process entire subdirectory and clone the folder structure. Change the file format, define JPG compression, JPG subformat, resample, define dimensions or scale... do some processing like sharpening, ad watermarks...

Yea. I love it.


Old answer before the update.

Simply put.

Some Browsers and Image viewers can not interpret a CMYK file correctlty, so will render wacky colors. Do not use them to judge CMYK colors.

Use professional software with built-in color management for CMYK images.

Photoshop, Indesign, Illustrator, Corel Draw, or Scribus, which is free. (I think also Affinity Design or Photo)

If you export to PDF, only use Adobe Reader or Adobe Acrobat. Some other free PDF can also render the colors incorrectly.

3
  • "Do not use them to judge CMYK colors." Ok! I don't intend to do so. I want to convert to RGB. My question is simply: can I convert/correct for the issue with gm command line tool as thousands of images are affected.
    – agoldev
    Mar 14, 2023 at 14:45
  • I edited my answer. I left the old answer below just for coherence. I hope it helps you solve your problem.
    – Rafael
    Mar 15, 2023 at 17:59
  • I'm going to mark your's as correct. However, we needed the solution in command line tools as this runs as part of a SAAS web application and processes images on-the-fly for customers. It needed to be scripted. Thus, I left a more technical comment on my SO Post: stackoverflow.com/questions/75484709/…
    – agoldev
    Mar 21, 2023 at 16:07
0

Rafael has the correct answer here but there's something else that should be mentioned.

You shouldn't ever use CMYK images for display on the web. Most web browsers can't display them properly - the colours will be mangled. Many home/office grade printers can't even print CMYK images properly. CMYK is for professional printing, mainly required for creating separations for traditional printing processes such as lithography or screen printing.

The standard for displaying images on web is RGB, with an sRGB colour profile. This is probably the closest thing you can get to displaying colours consistently across the web, and for anyone who does not have access to professional grade software, such as Photoshop. Although some free image editing software can also handle CMYK files, such as Krita. However this is not a perfect solution either, as different devices and software may still show colours differently, but that is something you cannot control.

So with that in mind, I would suggest you export a copy of the image to RGB, with an sRGB colour profile, and use this for display purposes.

Anyway, try this example RGB image with an sRGB colour profile, and try it with different viewers/browsers.

9
  • Kerr: "You shouldn't ever use CMYK images for display on the web." Ok! I don't intend to do so. I updated my OP. I want to convert to RGB. My question is simply: can I convert/correct for the issue with gm command line tool as thousands of images are affected.
    – agoldev
    Mar 14, 2023 at 14:45
  • @agoldev I don't know what gm command line is. Sorry. Ask on superuser perhaps. But you can do this in raster image editing software such as Photoshop or Krita (free).
    – Billy Kerr
    Mar 14, 2023 at 14:50
  • @BillyKerr gm is possibly graphics magic, which is a fork of imagemagic. op should just specify the icc engine to be used problem is knowing if all the images are properly tagged. But the question isnt interesting to me so i wont fix the technical aspect.
    – joojaa
    Mar 14, 2023 at 14:55
  • @joojaa yes interesting. I found something related to using command line tools here on stackoverflow which might be useful. The accepted answer for imagemagick might be useful perhaps.
    – Billy Kerr
    Mar 14, 2023 at 15:05
  • @agoldev - check out the link in my comment to joojaa above. Also note that stackoverflow is probably a better place to ask about command line tools.
    – Billy Kerr
    Mar 14, 2023 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.