can one tile in cmyk

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

can one tile in cmyk

Post by fmw42 »

It does not look to me that one can tile a cmyk pattern. Can someone confirm?

This only produces a white image for tmp.jpg


convert -size 8x8 xc:"cmyk(0,0,0,0)" xc:"cmyk(0,0,0,50)" +append \( +clone -flop \) -append ps_checks_cmyk.jpg
convert -size 300x300 xc: -tile ps_checks_cmyk.jpg tmp.jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: can one tile in cmyk

Post by anthony »

JPG only seem to work with CMYK if you have a profile added.

this work fine!!!
convert -size 8x8 xc:"cmyk(0,0,0,0)" xc:"cmyk(0,0,0,50)" +append \( +clone -flop \) -append \
-colorspace RGB show:

This also

convert -size 8x8 xc:"cmyk(0,0,0,0)" xc:"cmyk(0,0,0,50)" +append \( +clone -flop \) -append t.jpg
convert t.jpg -colorspace rgb show:


Hmmm the 'color name comment' appear bad for TXT images too...

convert xc:black -colorspace CMYK txt:
# ImageMagick pixel enumeration: 1,1,65535,cmyk
0,0: ( 0, 0, 0,65535) #000000000000FFFF black

convert xc:white -colorspace CMYK txt:
# ImageMagick pixel enumeration: 1,1,65535,cmyk
0,0: ( 0, 0, 0, 0) #0000000000000000 black
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: can one tile in cmyk

Post by Drarakel »

CMYK in JPG (without color profiles) is fine. It's just that some viewers have problems with that. (And in some cases, one has to negate the channels manually.)
But the color names for CMYK are partly wrong. I can confirm that.

@Fred:
convert -size 300x300 xc: -tile ps_checks_cmyk.jpg tmp.jpg
One problem could be, that the 'xc:' generates a RGB picture first and your JPG is CMYK? But even if you use 'xc:"cmyk(0,0,0,0)"' instead of 'xc:', the output will stay wrong. Probably the tiling indeed doesn't work in CMYK (I couldn't get it to work either). That wouldn't be a surprise, as many operations in IM work correctly only in RGB - right?

One (ugly) solution: Create the image as 'CMY' instead of CMYK and treat that as RGB in between. :)

Code: Select all

convert -depth 8 -size 8x8 xc:"cmyk(0,0,0,0)" xc:"cmyk(50,50,50,0)" +append \( +clone -flop \) -append ps_checks_cmyk1.tif
convert -size 300x300 tile:ps_checks_cmyk1.tif -set colorspace cmyk board1.jpg
Better solution (still some work):

Code: Select all

convert -depth 8 -size 8x8 xc:"cmyk(0,0,0,0)" xc:"cmyk(0,0,0,50)" +append \( +clone -flop \) -append -separate temp.tif
convert -size 300x300 tile:temp.tif[0] tile:temp.tif[1] tile:temp.tif[2] tile:temp.tif[3] -set colorspace cmyk -combine board2.jpg
Maybe there is a simpler solution? Of course, you might switch to RGB completely in your case as long as the tiling itself doesn't work in CMYK.
(I had to do some evaluate operations and compositions on a CMYK picture lately - and I didn't want to degrade the picture by converting the colorspaces. So, here, I also ended up with doing all my operations on the separated channels.)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: can one tile in cmyk

Post by fmw42 »

Thanks.

Interesting approaches.

The reason I posted this was that I was having trouble with my other post viewtopic.php?f=1&t=16764 and thought I would tile in cmyk. But I finally figure out how to use profiles and got my original post working. So this post here is not as urgent.

Still interesting that one cannot tile directly in cmyk, but not totally surprising as you say since some operations only work in rgb in IM
Post Reply