Example using convert command with time limit

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
peterpham
Posts: 5
Joined: 2010-10-24T18:29:17-07:00
Authentication code: 8675308

Example using convert command with time limit

Post by peterpham »

i believe that you can use -limit time to restrict how long the convert to be timeout.
But I cannot find an example how to use it.

I was trying to convert multiple page PDF to PNGs and using this following command to limit it to 10seconds:

Code: Select all

convert -limit time 10 input.pdf output.png
The process, indeed, did time out but after about 1 minute.
I wonder whether I had use wrong syntax, or the 10sec limit was only started count down during convert command but not when GhostScript was running.

Also, when trying convert with option -limit memory, as in

Code: Select all

convert -limit memory 512MiB input.pdf output.png
checking Activity Monitor (MAC OSX) as well as using top command, the real memory shows that:
- There was a few seconds when the process's memory took over 1GB
- Most of the time, the memory took around 550MB.
In either case, the memory seems to exceed the set limit of 512MiB.
Is there any other resources including in this real memory consumption?

Thanks
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Example using convert command with time limit

Post by anthony »

The timer is only checked during the normal IM processing. IM has no control over how other programs such as ghostscript takes.

I do have a wrapper script that tries to timeout a command that the script runs..
http://www.ict.griffith.edu.au/anthony/ ... e/#timeout
Note this is not strictly a IM solution, but a general shell scripting solution.
linux also provides a similar command for timing out applications.

I make no guarantees.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply