ImageMagick hanging ?

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
metsfan666

ImageMagick hanging ?

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick hanging ?

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
metsfan666

Re: ImageMagick hanging ?

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