Change JPEG Compression Quality in WordPress

WordPress generates several image sizes according to your theme settings. These images are created at quality 90 on a scale of 1-100 by default. You can save bandwidth by changing this setting to 75 for more aggressive compression.

/**
 * Snippet Name: Change jpg compression level
 */
function sv_jpeg_quality() {
	return 75;
}
add_filter( 'jpeg_quality', 'sv_jpeg_quality' );

For more on optimizing images for WordPress, see optimizing WordPress images for SEO.

Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!