Are there any limits on the "convert" and "mogrify" programs?

The ImageMagick “convert” and “mogrify” programs can be useful, but they’re also extremely resource-intensive because of the “temporary files” they create.

For example, using these programs to make minor edits (like adding a white border to a JPEG file) can write over 250 MB of data to the server’s local disk array. Some scripts perform these kinds of tasks on a batch of photos, resulting in many GB of disk writes in a short period of time.

This kind of disk writing vastly exceeds our disk usage policy and can cause performance problems for other users on the same server.

To prevent those problems, the convert and mogrify programs on our servers create the temporary files in memory only (using a tmpfs). This makes the programs run much more quickly than they would on most servers, with no impact on other users.

Because the “temporary files” are actually stored in RAM, the convert and mogrify programs have a limit of 500 MB of memory. That’s plenty for the kind of conversions that are appropriate to do on a live Web server. If you’re performing very large conversions that exceed that, you should do them on your own computer and upload the resulting files.

Are the MAGICK_TMPDIR and MAGICK_THREAD_LIMIT environment variables related to this?

Yes, our systems set two environment variables that technically advanced users might notice. They are:


The first forces ImageMagick to use a tmpfs; the second avoids a common error (“libgomp: Thread creation failed: Resource temporarily unavailable”) when processing large files.