-color-matrix not working in Obj-C port

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
haabaato
Posts: 1
Joined: 2011-11-27T20:52:24-07:00
Authentication code: 8675308

-color-matrix not working in Obj-C port

Post by haabaato »

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.
Post Reply