Page 1 of 1

ImageMagick EXEC return value in negative

Posted: 2016-08-30T07:38:51-07:00
by agriz

Code: Select all

exec("convert \( *-1.png +append -flatten  \)   \( *-2.png +append -flatten \)  \( *-3.png +append -flatten \) +append output.png 2>&1", $output, $return);
//edit
//previous one was working.
//This one is causing problem.
//Approximately, about 70 images to be loaded. But throwing that negative number and there is no ouput.

Code: Select all


$output 
Array
(
)

$return
-1073740791
What does the negative number mean?
If i add just two images it works.

Version : 7.0.2

Re: ImageMagick EXEC return value in negative

Posted: 2016-08-30T09:32:59-07:00
by fmw42
I do not know what that return value is. Probably not coming from IM, but from exec().

If on IM 7, replace convert with magick. Does that help?

How big are your image? 70 images is a lot to hold in memory. Have tried with just a few images? Perhaps your tmp directory is getting too full?

Re: ImageMagick EXEC return value in negative

Posted: 2016-08-30T09:50:57-07:00
by agriz
Few Images works. Tmp directory works. If i join the command to single command, it fails.

Re: ImageMagick EXEC return value in negative

Posted: 2016-08-30T11:38:05-07:00
by fmw42
You are either running out of memory or tmp space.
If i join the command to single command, it fails.
Sorry I do not know what this means.

Re: ImageMagick EXEC return value in negative

Posted: 2016-08-30T18:57:49-07:00
by agriz

Code: Select all


exec("convert \( *-1.png +append -flatten  \)   \( *-2.png +append -flatten \)  \( *-3.png +append -flatten \) +append output.png 2>&1", $output, $return);
This is the single command. It fails


convert \( *-1.png +append -flatten  \)  tmp_1.png
convert \( *-2.png +append -flatten  \)  tmp_2.png
convert \( *-3.png +append -flatten  \)  tmp_3.png

convert tmp_1.png tmp_2.png tmp_3.png + append output.png

Multiple command and It works.

This two method produce the same output. Is there any performance difference?
In the first command, the temp images are not stored in disk. Where are they stored?

\( *-1.png +append -flatten \) - where is the result of this line stored?

Re: ImageMagick EXEC return value in negative

Posted: 2016-08-30T19:19:48-07:00
by fmw42
Your first command is run via PHP exec()? Did you run your separate commands via PHP exec(). If not, then PHP may have limits set on memory usage that you do not get otherwise.

Performance would be slower with separate commands since you have to write and then read the tmps.

Re: ImageMagick EXEC return value in negative

Posted: 2016-08-30T19:26:05-07:00
by agriz
I will try to change the memory limit of php and let you know sir