I'm attempting to use the following command which turns an image red in my iOS app:
convert sample.png -color-matrix "1.0 0.715 0.072 0.0 0.0 0 0.715 0.072 0.0 0.0 0 0.715 0.072 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0" red.png
However, when using MagickCommandGenesis in Obj-C, the image is left unchanged. Also, the ExceptionInfo struct is never populated with anything useful and no error messages printed to the console, so I have no idea why this is failing. Here's the obj-C code:
ImageInfo *imgInfo = AcquireImageInfo();
MagickExceptionInfo *exceptionInfo = AcquireExceptionInfo();
MagickCommand command = ConvertImageCommand;
MagickBooleanType status;
<snip>
char *argv[] = { "convert",
(char *) [origFilePath cStringUsingEncoding:NSUTF8StringEncoding],
"-color-matrix",
// Note there's no commas because the color matrix coefficients are in one long string
"\"1.0 0.715 0.072 0.0 0.0, 0 0.715 0.072 0.0 0.0, 0 0.715 0.072 0.0 0.0, 0.0 0.0 0.0 1.0 0.0, 0.0 0.0 0.0 0.0 1.0\"",
(char *) [outFilepath cStringUsingEncoding:NSUTF8StringEncoding],
NULL };
numArgs = 5;
status = MagickCommandGenesis(imgInfo, command, numArgs, argv, (char **) NULL, exceptionInfo);
Just fyi, I'm using other parameters aside from -color-matrix, and they all work fine. Any clue on what I'm doing wrong here? Thanks ahead of time.