CMYK separation - with colored channels

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

CMYK separation - with colored channels

Post by Lars-Daniel »

Can anyone tell me, how to separate a CMYK into its channels and recolor them?
You can find all the demo files here: http://ge.tt/7OSDMEO2

I've tried different ways, but never had any success... I tried:
viewtopic.php?t=20729
viewtopic.php?t=21353
viewtopic.php?t=15571
http://stackoverflow.com/questions/2127 ... cmyk-black
and others

Sure, this works, but creates greyscale images only:
convert seperate_me.tif -colorspace CMYK -separate separate_CMYK_%d.tif
I tried to recolor them, but -tint 100 introduced some black and greyscale dots or colors. Seems like dithering?

Anyone with an idea? The profile of the incoming CMYK image is ECI v2 300% (current European PrePress standard with 300%)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CMYK separation - with colored channels

Post by snibgo »

On your first link, "download all" does nothing for me.

Separating an image creates one grayscale image per channel. If you want to colour that grayscale image with the appropriate color, "+level-colors" is convenient. See http://www.imagemagick.org/script/comma ... vel-colors

For example, if you want black to become cyan but white to stay white:

Code: Select all

convert in.png +level-colors cyan,white out.png
snibgo's IM pages: im.snibgo.com
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: CMYK separation - with colored channels

Post by Lars-Daniel »

snibgo wrote:On your first link, "download all" does nothing for me.
It works now. Seems like there's a cronjob running once an hour or so until the ZIP gets created :D
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CMYK separation - with colored channels

Post by snibgo »

It still does nothing for me. Have I answered your question?
snibgo's IM pages: im.snibgo.com
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: CMYK separation - with colored channels

Post by Lars-Daniel »

snibgo wrote:It still does nothing for me. Have I answered your question?
partially :) Thanks for your help!

This finally did it for me:

Code: Select all

/usr/bin/convert seperate_me.tif -colorspace cmyk -channel c -negate -separate channel_c.tif
/usr/bin/convert seperate_me.tif -colorspace cmyk -channel m -negate -separate channel_m.tif
/usr/bin/convert seperate_me.tif -colorspace cmyk -channel y -negate -separate channel_y.tif
/usr/bin/convert seperate_me.tif -colorspace cmyk -channel k -negate -separate channel_k.tif

/usr/bin/convert channel_c.tif +level-colors cyan,white channel_c_colored.tif
/usr/bin/convert channel_m.tif +level-colors magenta,white channel_m_colored.tif
/usr/bin/convert channel_y.tif +level-colors yellow,white channel_y_colored.tif
One last thing. I've figured out, the images created in the last step are RGB. Seems like I have to add "-colorspace cmyk", don't I?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CMYK separation - with colored channels

Post by snibgo »

Good stuff. You can conflate the seven commands into one, if you want, which saves re-reading images. Windows BAT syntax:

Code: Select all

convert ^
  rose: ^
  -colorspace CMYK ^
  -separate -negate ^
  ( -clone 0 ^
    +write channel_c.tif ^
    +level-colors cyan,white ^
    +write channel_c_colored.tif ^
    +delete ) ^
  -delete 0 ^
  ( -clone 0 ^
    +write channel_m.tif ^
    +level-colors magenta,white ^
    +write channel_m_colored.tif ^
    +delete ) ^
  -delete 0 ^
  ( -clone 0 ^
    +write channel_y.tif ^
    +level-colors yellow,white ^
    +write channel_y_colored.tif ^
    +delete ) ^
  -delete 0 ^
  channel_k.tif
snibgo's IM pages: im.snibgo.com
Post Reply