Page 1 of 1

ImageMagick hanging ?

Posted: 2008-02-06T14:51:16-07:00
by metsfan666
This is very peculiar. I'm working on a new script for my site which uses IM to make graphics. For a while, everything was working, but now all of a sudden the script hangs after processing only a few commands.

I build up a list of IM commands in an array and then loop through the array and execute each of the commands.

Here's a sample of the commands, nothing fancy:

convert -size 60x60 xc:#000000 -fill #FF0000 -pointsize 8 -font fonts/new/arial.ttf -gravity center -draw "text 1,0 'HI'" canvas.gif
array[0] => "composite images/01/t_01.gif canvas.gif out0.gif"
array[1] => "composite images/01/t_02.gif canvas.gif out1.gif"
array[2] => "composite images/01/t_03.gif canvas.gif out2.gif"
array[3] => "composite images/01/t_04.gif canvas.gif out3.gif"

This array can grow from 4 commands to about 20. This was at some point all working then it just stopped. I'm using apache on windows and this is a php script.

When I upload this script to my host and test it out, no problems at all. It seems like something locally is messed up but I have no idea what especially since this was all working.

Any ideas?

Re: ImageMagick hanging ?

Posted: 2008-02-06T17:59:37-07:00
by anthony
Is the directory it is in writable by the WEB process user?

It may be you patched your machine and some directory permissions (or SE Linux security) is preventing the file being written.

Better still don't write a temporary. See IM exmaples, Image Layers for a half dozen other methods of creating a mutli-image composted image. Most only use a single command rather than multiple commands.

As you are building up your IM command, you could be about to generate a very complex program. I do simular things to generate animations of many IM commands within IM examples, but using a shell script rather than PHP.

Re: ImageMagick hanging ?

Posted: 2008-02-08T13:52:38-07:00
by metsfan666
After playing around with the code, I found that running all the commands after i start drawing the page causes the script to hang. When i made the execution of the commands the first thing, it works problem free.

As for creating the animation with one call IM, that sounds like it would be an excellent speed boost. However, for whatever reason, when i've tried the samples, i did not have much success. Can you point me in the right direction please?

Thanks