Performance improvements for images in WordPress 4.5
WordPress 4.5 includes a few performance enhancements for images.
WordPress 4.5 increases the amount of compression applied to intermediate sizes by changing the default quality in
WP_Image_Editor from 90 to 82. As noted in the proposal for this change, this results in a noticeable reduction in file sizes with little change in visual quality. Developers can override the default image quality value using the
For sites making use of ImageMagick, we’ve reduced file sizes further by resizing images more efficiently in
WP_Image_Editor_Imagick and by stripping extraneous metadata using the new
For now, ‘icc’ and ‘icm’ color profiles are retained, along with ‘exif’, ‘xmp’, and ‘iptc’ profiles, which can contain copyright and orientation data. Those who want to retain additional metadata can disable profile stripping by adding a callback function to the
image_strip_meta hook that returns
Note that the original full sized images uploaded to WordPress are unaffected by these changes.
As Jeremy Felt mentioned in his post on Multisite changes,
wp_upload_dir() received a major performance overhaul in this release. Those changes were pared with the addition of a new function,
wp_get_upload_dir(), which can be used as a more performant way to display information about the uploads directory on the front end. This is particularly useful when building URLs for images in templates. (See #34359)