Imagick vs GD in WordPress
Last Updated -
What Are Imagick and GD?
Imagick and GD are popular image optimization libraries in PHP applications. While they both perform many of the same actions, they operate a bit different from each other and offer different benefits.
Overall, these two libraries are used for:
- Resizing/cropping images.
- Modifying the contents of an image.
- Image compression.
- Conversion to different file types.
- Applying image filters such as adjusting contrast, brightness, colors, etc.
Are Both Imagick and GD Available?
All Pagely servers come with both GD and Imagick modules available. However, the WordPress core media.php file defaults to GD as its image editor of choice.
Which Should I Use?
In most cases, it doesn't really matter much. Both libraries support the majority of common file types and perform similarly in a typical WordPress environment. However, if you have an extremely image-heavy site or are dealing with more obscure image file formats, you might want to make a deeper decision based on your particular needs.
Generally speaking, the differences are:
- GD is generally a slight bit faster when dealing with large images.
- Imagick supports a larger number of image formats.
- Imagick is usually better at producing higher quality images (although sometimes at the expense of file size).
What If I Want to Use Imagick?
Since it's statically defined in the WordPress core file, modifying the image editor must be done using an
add_filter step inside of each WordPress application at Pagely.
We suggest installing the "Force use of ImageMagick image library (mhm-forceimagemagick)" plugin on each site where you wish to use the Imagick module. The plugin sets WP_Image_Editor_Imagick as the one and only option.
Note: Pagely's policy is to provide a 'vanilla' WordPress core. We do not modify any code that is distributed as part of the default software. We recommend using the facilities provided in WordPress to modify the application's behavior as needed.