
Something to keep in mind with the examples below is that the source image was a jpeg, resized to 250px jpegs, then sent to a jpeg screenshot (the source PNGs was just far too large to embed in this post). Below are the results with sharpening set to "none". The source image is 3 megapixels at 600 kb, resized down to a width of 250 pixels wide. I took a couple of screenshots demonstrating resizes on the same source image between GD and ImageMagick in a ProcessWire installation. I imagine the future will also bring more options, including modules that can compress the hell out of images without visual quality loss, and engines that use external services… the possibilities are numerous. Horst is currently working on modules that support the CLI versions of ImageMagick and NetPBM. However, there are more ImageSizerEngine modules in the works. The IMagick module mentioned above is the first ImageSizerEngine module available, and it's such an improvement that we thought it belonged in the core. The last fallback is the existing GD engine, which is available in pretty much all PHP installations, making it the ideal fallback. If one ImageSizerEngine module can't perform a resize of a particular image, it passes it on to the next one in priority order.
IMAGEMAGICK RESIZE INSTALL
You can install multiple ImageSizerEngine modules and indicate the order in which they should be tried. This enables one to install new modules to handle image manipulations, much in the same way one can currently install WireMail modules to handle email delivery. Horst and I collaborated on making ImageSizerEngine, a new module type in the ProcessWire core (of which the IMagick one is the first example). For instance, my subjective opinion is that a quality setting of 85 in IMagick is equivalent to a quality setting of 90 in GD, and produces similar file sizes. I've found that I can use a lower quality setting in IMagick and get the same result as in GD. ImageMagick quality settings aren't exactly the same as quality settings in GD. If there is a situation where ImageMagick can't perform the resize, control will be passed back to the existing GD resizer. You don't have to do anything other than install the module. You'll notice quicker resizes as soon as you upload new images. Once the ImageSizerEngineIMagick module is installed, all image resizes that can use ImageMagick will use them. It may be fairly simple to enable ImageMagick on a PHP installation that doesn't have it, but needs to be installed by someone that has control over the PHP configuration. If the library is not available, installation will fail with an error message indicating that. There's one potential problem though: not all PHP installations have the ImageMagick library available. To install, go to Modules > Core > Image and click Install. ProcessWire 3.0.10 now comes with a new module called ImageSizerEngineIMagick. This image is hopefully much larger than those you would ever come across, but just goes to show you how strong the IMagick engine is. GD wouldn't have been able to handle an image even half that size. For instance, I threw this large photo (~27mb, 21600x10800 pixels) at our new IMagick resizer, and while it understandably took some time to complete, it was able to resize it just fine. IMagick can resize really large images that GD can't touch.


Meaning, if an image previously took 10 seconds to resize, it might now only take 3-4 seconds. Resizes are more than twice as fast as resizes performed by GD. Relative to GD, ImageMagick has a couple of nice benefits in ProcessWire: He has developed a new image resizing engine for ProcessWire that uses ImageMagick (PHP's IMagick) library. We've been on the lookout for ways to improve the areas mentioned above and Horst found a way to make it happen. And even when it can handle them, you might be waiting a bit for it to generate thumbnails, or perform resizes for large groups of images. Sometimes GD simply can't handle really large photos straight off of high-megapixel digital cameras, because manipulating them takes more memory than is available to PHP. However, areas where it lacks are in speed and ability to resize really large images. ProcessWire's image manipulations have always been handled by the PHP GD library, which does quite a nice job in terms of quality and file size. We've got some really nice upgrades to our image resizing engine, thanks to our resident image and photography expert, Horst.
