When I run ImageMagick to create an animated GIF from a large number of images, it uses resources such that my i7 system becomes unusable. Within seconds of starting, everything freezes and, ultimately, requires a manual reset of the computer (I can't even kill the process in another terminal due to the sluggishess).

How can I prevent ImageMagick from taking up so much of the system resources? I have already tried using export MAGICK_THREAD_LIMIT=1 before running it.

  • 2
    You can start by running it on fewer images, and try to find out if it's CPU usage or disk usage, that freeze the system. Use top/iotop to help you. Then try changing nice/ionice levels: askubuntu.com/questions/25271/… Nov 7, 2015 at 23:51
  • @mikewhatever Hey there, thanks for your comment. I gave the following commands a try featuring your priority-change approach: export MAGICK_THREAD_LIMIT=1; sudo nice -n 19 convert -delay 5 -loop 0 -layers optimize "${directoryName1}"/*.jpg output.gif. It's an interesting idea, but the system still locked up. Would you happen to have any other suggestions? For the purposes of the task at hand, I can't reduce the number of images, but how could I limit ImageMagick in other ways? I don't mind it taking ages to run so long as it doesn't lock up the system.
    – d3pd
    Nov 8, 2015 at 7:20
  • 1
    Unfortunately convert is designed to hold all images in memory while processing them. Therefore the amount of images we can process is limited through their size, and the RAM we have.
    – Takkat
    Nov 8, 2015 at 7:47
  • @Takkat Thanks for your comment. According to this, the memory usage can be limited using an option like -limit memory 64. I reduced the size of all of the images (such that in total they are collectively only about 60 MB) and I tried the memory limit option, but the system still locked up. Would you have any other ideas?
    – d3pd
    Nov 8, 2015 at 9:07


You must log in to answer this question.

Browse other questions tagged .