Convert tiff from RGB to CMYK

Dec 6, 2013 at 11:33 PM
Edited Dec 6, 2013 at 11:34 PM
I am trying to convert an image from RGB to CMYK. No matter what I do, I cannot save the image as a decent CMYK format. It either saves as pixelated CMYK, or as a very nice RGB. But I need it to go to a printer. It must be high quality CMYK.

I've tried literally 100s of combinations of code. Here is where I am right now, but nothing I have tried works.
        string oldFile = "c:\\Temp\\agent-j-peck1Before.tif";
        string newFile = "c:\\Temp\\agent-j-peck1After.tif";
        if (File.Exists(newFile))
            MagickImage img = new MagickImage(oldFile);
            img.ColorSpace = ColorSpace.CMYK;
            img.CompressionMethod = CompressionMethod.LZW;
You can download the image here to see the original.

Note, when it does save it as CMYK, the quality drops to a fraction of the original.

Any help appreciated. I really need to have this done by Monday. I have been struggling with this for days.
Dec 7, 2013 at 7:38 AM
Edited Dec 7, 2013 at 7:47 AM
When converting between RGB and CMYK you should use color profiles. You can do that like this:
using (MagickImage image = new MagickImage("agent-j-peck1Before.tif"))
  image.AddProfile(new ColorProfile("USWebCoatedSWOP.icc"));
  image.ColorSpace = ColorSpace.CMYK;
  image.CompressionMethod = CompressionMethod.LZW;
You can download the profile here: That zip file contains multiple profiles. You should probably try to see which CMYK profile provides the best result for you.
Dec 7, 2013 at 7:43 PM
First off, thank you.
Secondly here is my new code. I downloaded the color profile from the site above. I unzipped it into my project. But now I get an SEHException on the ColorSpace.CMYK line?

using (MagickImage image = new MagickImage())
            image.AddProfile(new ColorProfile(Server.MapPath("~/ColorProfile/CMYK/USWebCoatedSWOP.icc")));
            image.ColorSpace = ColorSpace.CMYK;
            image.Read(oldFile, mySettings);
Dec 7, 2013 at 8:22 PM
Edited Dec 7, 2013 at 8:22 PM
It seems ImageMagick is raising an exception. I will make sure this exception is caught an raised properly before the next release. You need to read the image before you add the profile and change the colorspace.
using (MagickImage image = new MagickImage(oldFile, mySettings))
  image.AddProfile(new ColorProfile(Server.MapPath("~/ColorProfile/CMYK/USWebCoatedSWOP.icc")));
  image.ColorSpace = ColorSpace.CMYK;
Dec 7, 2013 at 9:53 PM
Oh, DUH! Stupid on my part. I had been moving them around trying to resolve the problem. That actually makes perfect sense.

I flipped them around and it works perfectly now!!! Thanks so much!!

By the way, to show my extreme appreciation, I bought you a toy off of your wish list.
Dec 8, 2013 at 5:25 PM
First of all, thank you very much for your donation. I included a couple of color profiles within Magick.NET. With the next release you will be able to use ColorProfile.USWebCoatedSWOP or ColorProfile.CoatedFOGRA39.