Problems creating a mask

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
valerie

Problems creating a mask

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problems creating a mask

Post 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 :)
Post Reply