So I am happy to report that removing that
QuantumRange fixes the issue with negated Black channel. Just recompiled ImageMagick on my Ubuntu machine and the issue is gone. The only thing you need to ensure is that the image that you are "copyingBlack from"
does in fact contain Black channel i.e. if you have the B/W image that you made using
-separate you need to first convert it to CMYK before applying
CopyBlack operator to it.
Yay! We fixed the issue. Thank you @snibgo.
Not sure we broke something in the process, but this was super fast.
Code: Select all
(QuantumRange- GetPixelBlack(source_image,p))
Perhaps this ^ came from definition of CMYK colorspace here
https://imagemagick.org/script/command- ... colorspace, but it does not match the formula there either. Another thought: it is a little counterintuitive that user needs to convert Grayscale image of the
K channel to
CMYK in order for
CopyBlack to work. User believes grayscale values become K channel automatically, as the case is with CopyOpacity. I wonder if it is possible to "convert - colorspace CMYK" that image on the fly before applying the CopyBlack operation?