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?".
The following code works here for colorspace 'gray' and 'rgb', but fails for 'cmyk'. The final graphic is empty (no shadow) in the later case.
If I use a different color than black (e.g. '+level-colors red') things work ok even with cmyk.
This (shortened and simplyfied) code is taken from an automatically generated test batch file ('blackening' an already black gfx still make no sense).
+level-colors need two colors to be specified otherwise, it assumes some other color, but I am not sure what that is, perhaps black. So then you will translate all grayshades into black. Try black,white or white,black and see if that helps. Or put a comma before or after black. see http://www.imagemagick.org/Usage/color_ ... vel-colors
Thanks for the quick reply. Tested with all combinations and the result is the same.
I have added a comma after the color to fit the requirements.
As I understand it, the same color is also used for the white point, if none is given.
The '-shadow' created graphic is unicolor (here always full black), only the opacity values vary. So one color should be enough here.
Also: this works in all other color spaces and with (as far as I have tested) all other colors. I'm puzzled.
Just remember +/-level-color is exactly as per +/-level but with the values specified using color names.
NOTE color names are not currently mapped to match the image colorspace. As such 'red' may not mean 'red' in a CMYK image.. (This may change in the near future)
Without a 'comma' in the arguemnt +level-color assumes the color is both the balck and white point, and thus replaces the whole image with that color.
This is exactly what I want. I tried to 'replace' the color, but '+level-colors' was the only working method.
The idea behind it is to do the shadow calculation (umbra+preambra area and some modifications) in Gray colorspace and to colorize it in the final step.
NOTE color names are not currently mapped to match the image colorspace. As such 'red' may not mean 'red' in a CMYK image.. (This may change in the near future)
That sounded promising, but a test with color 'cmyk(0,0,0,255)' instead of 'black' also fails....
Because CYMK is one of the supported color spaces. I write on a ConTeXt module, that uses IM to create drop shadows of squared areas (boxes). If someone needs to create CMYK only documents (no prepress step with proper color conversion before printing), this is the only way to go.
indiego wrote:Because CYMK is one of the supported color spaces. I write on a ConTeXt module, that uses IM to create drop shadows of squared areas (boxes). If someone needs to create CMYK only documents (no prepress step with proper color conversion before printing), this is the only way to go.
I doubt this will help, but try putting -colorspace CMYK at the very end before the output. Or save the rgb output and then convert to cmyk in another step. See if the rgb result is correct?