Replacing Graphics::Magick with Imager
Today I moved Fastmail’s image processing backend (used for attachment thumbnailing and image galleries) from
Imager, due to the former’s tendency to crash on some kinds of bogus input, leaving core and data files lying around, filling the disk.
If you are doing image processing in Perl and you’re using
Image::Imlib2 or anything else that’s not Imager, you are almost certainly doing wrong.
Reasons to like it:
- Its not a binding to an external lib, so it feels like Perl and doesn’t carry a pile of baggage.
- The image processing core is written in C, so its fast.
- It doesn’t use temporary files (and so can’t leave them lying around if it fails).
- The documentation is superb. Replacing existing functionality was mostly a case of searching for the right keyword and pasting the example in.
- Its actively maintained. The last release was just five days ago.
Its missing a couple of features that I’d like (writing EXIF data and a filter for two-dimensional convolution matrices) but they can be worked around easily enough.
This should be your first choice for image processing in Perl. That is all.
Magick should never have even been a library. It started as a big command line set, and was never structured correctly internally to be used in a long-running process.
Unfortunately pretty much everything that has come along since then trying to fix the problem has ended up making it worse by over-engineering everything so you end up with something slow, or with a crap interface, or with a billion dependencies.
I don’t know if Imager is the right way to do it, but so far its the best I’ve seen for what it does.