I tried your script with CMYK tiff image simply created with
convert -colorspace CMYK 2mgnsdh.png 2mgnsdh-CMYK.tiff
(To compare I also created 2mgnsdh-RGB.tiff with "convert 2mgnsdh.png 2mgnsdh-RGB.tiff". )
I soon noticed all CMY values of this tiff is 0 so I add -channel K for +level:
Code: Select all
convert 2mgnsdh-CMYK.tiff \
\( -clone 0 -channel K -alpha off +level 100%x0% \) \
\( -clone 0 -alpha extract \) \
\( -clone 1 -clone 2 -compose multiply -composite \) \
-delete 1,2 \
-alpha off -compose copy_opacity -composite result.tiff
Comparing with the case of RGB, 1) the result has something like edge and 2) background transparency lost.
Could you tell me what I am missing?
As for transparency, original image
Alpha: cmyka(0,0,0,9,0) #0000000900
Histogram:
19785: ( 0, 0, 0, 9, 0) #0000000900 cmyka(0,0,0,9,0)
463: ( 0, 0, 0,210,255) #000000D2 cmyka(0,0,0,210,1)
...
Transparent color: cmyka(0,0,0,0,0)
turned out to
Histogram:
12627: ( 0, 0, 0, 0,255) #00000000 cmyka(0,0,0,0,1)
985: ( 0, 0, 0, 7,255) #00000007 cmyka(0,0,0,7,1)
983: ( 0, 0, 0, 5,255) #00000005 cmyka(0,0,0,5,1)
908: ( 0, 0, 0, 9,255) #00000009 cmyka(0,0,0,9,1)
...
Transparent color: cmyka(0,0,0,0,0)
so, I understand what happened, but don't know how to fix it.
Best wishes,