Page 1 of 1

convert cmyk to grayscale with all channels zero except k

Posted: 2009-03-05T01:40:01-07:00
by scholli
Hello,

i'm an absolute beginner in handling images. My original problem is, that i have an image in cmyk which i want to convert into grayscale so that the channels cmy are set to zero for the whole image. I tried several things, including converting it to grayscale with gimp, but when i import it in scribus (my dtp-programm) the cmy channels are again not zero.

Thanks for any suggestions!
Daniel

Re: convert cmyk to grayscale with all channels zero except k

Posted: 2009-03-05T14:03:30-07:00
by fmw42
scholli wrote:Hello,

i'm an absolute beginner in handling images. My original problem is, that i have an image in cmyk which i want to convert into grayscale so that the channels cmy are set to zero for the whole image. I tried several things, including converting it to grayscale with gimp, but when i import it in scribus (my dtp-programm) the cmy channels are again not zero.

Thanks for any suggestions!
Daniel
Good reading at:
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/Usage/



Two ways, depending upon what you want at the end.

Create CMYK Test image:
convert rose: -colorspace cmyk rose_cmyk.psd

(note rose: is a special internal IM image. other images need a suffix and no colon. see http://www.imagemagick.org/script/forma ... tin-images)

identify -verbose rose_cmyk.psd
Image: rose_cmyk.psd
Type: ColorSeparation
Endianess: Undefined
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 8-bit
magenta: 8-bit
yellow: 8-bit
black: 8-bit
Channel statistics:
cyan:
min: 0 (0)
max: 119 (0.466667)
mean: 11.5071 (0.0451261)
standard deviation: 23.7152 (0.0930007)
kurtosis: 3.23961
skewness: 2.06088
magenta:
min: 0 (0)
max: 233 (0.913725)
mean: 83.9158 (0.329082)
standard deviation: 77.8988 (0.305485)
kurtosis: -1.65179
skewness: 0.245888
yellow:
min: 0 (0)
max: 217 (0.85098)
mean: 105.993 (0.415658)
standard deviation: 69.8437 (0.273897)
kurtosis: -1.42622
skewness: -0.0231882
black:
min: 0 (0)
max: 215 (0.843137)
mean: 102.968 (0.403795)
standard deviation: 68.3993 (0.268232)
kurtosis: -1.38096
skewness: 0.00776165


If you want it to be cmyk still then set cmy channels to black via threshold and leave black alone:
convert rose_cmyk.psd -channel cmy -threshold 100% +channel rose_cmy0_k.psd

identify -verbose rose_cmy0_k.psd
Type: ColorSeparation
Endianess: Undefined
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 1-bit
magenta: 1-bit
yellow: 1-bit
black: 8-bit
Channel statistics:
cyan:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
magenta:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
yellow:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
black:
min: 0 (0)
max: 215 (0.843137)
mean: 102.968 (0.403795)
standard deviation: 68.3993 (0.268232)
kurtosis: -1.38096
skewness: 0.00776165

If you just want to extract the black channel as true grayscale image, then do:

convert rose_cmyk.psd -channel black -separate rose_cmyk_black.psd
or
convert rose_cmyk.psd -channel black -separate rose_cmyk_black.gif

identify -verbose rose_cmyk_black.psd
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
gray:
min: 0 (0)
max: 215 (0.843137)
mean: 102.968 (0.403795)
standard deviation: 68.3993 (0.268232)
kurtosis: -1.38096
skewness: 0.00776165

However, the visual appearance of the results from each option are the negative of the other and still slightly different.

Perhaps Anthony or Magick can illuminate us on this difference.

Re: convert cmyk to grayscale with all channels zero except k

Posted: 2009-03-06T00:40:26-07:00
by scholli
Thanks for your answer!

I have two following questions:
1) What is the difference between Type and Colorspace in identify -verbose's output? For example in your last output there is Type Grayscale but Colorspace RGB. Does it just mean that it's an RGB image but with only gray values?

2) I learned there is a difference between converting an image into another colorspace or appending a colorspace to an image. What do i do when i use -colorspace/ -profile? I think i really convert the image? And how do i append a colorspace?

Re: convert cmyk to grayscale with all channels zero except k

Posted: 2009-03-06T11:40:59-07:00
by fmw42
scholli wrote:Thanks for your answer!

I have two following questions:
1) What is the difference between Type and Colorspace in identify -verbose's output? For example in your last output there is Type Grayscale but Colorspace RGB. Does it just mean that it's an RGB image but with only gray values?
I am by no means an expert on this issue. But type is more like the color bit-depth and colorspace is the way colors are represented (RGB, CMYK, HSL, etc).

See
http://www.imagemagick.org/script/comma ... s.php#type
http://www.imagemagick.org/script/comma ... colorspace
scholli wrote:2) I learned there is a difference between converting an image into another colorspace or appending a colorspace to an image. What do i do when i use -colorspace/ -profile? I think i really convert the image? And how do i append a colorspace?
I don't know about appending a colorspace. Never heard of that. The image has one colorspace representation, but it can have profiles to help characterize the colorspace.

See http://www.imagemagick.org/script/comma ... hp#profile

But I should leave any further comments and corrections to my statements to the experts, Anthony or Magick