Page 1 of 1

Problems creating a mask

Posted: 2007-09-17T11:23:19-07:00
by valerie
First let me start by saying thank you so much for ImageMagick and the examples. It's a great utility, and I appreciate the time everyone has put into it.

I'm having trouble creating a mask. I'm using PHP. I've tried two different ways:

Code: Select all

$mask = 'usr/bin/convert cyclops.png \( +clone -fx \'p{0,0}\' \) -compose Difference  -composite  -modulate 100,0  +matte  difference.png';
exec($mask);

$negate = 'convert cyclops.png -colorspace Gray -negate negate.png';
exec($negate);
Neither difference.png nor negate.png are being created. This method of calling to the command line works in other cases (animating, tiling), so I don't think it has to do with using the exec. I really have no idea what is going on and why neither of these are at least executing. I've also tried popen instead of exec, and gif files instead of png files.

ETA: Okay, the second one is now working, but I'm still confused as to why the first one is not, as I copied it from the examples page. The error code returned is 127.

Re: Problems creating a mask

Posted: 2007-09-17T13:17:15-07:00
by Bonzo
The main differance I can see between your examples is the one that works has convert and the one that does not has usr/bin/convert Is this the correct path ? I can use either usr/local/bin/convert and convert; as convert is shorter I stick to that.

It worked for me but I changed the code to:

Code: Select all

exec("convert cyclops.png \( +clone -fx \"p{0,0}\" \) -compose Difference -composite -modulate 100,0 +matte difference.png 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
I can see any errors better then and prefer this way of writting the code :)