JPQ Quality and WordPress

The EWWW IO plugin for WordPress allows you to change the default JPEG quality used by WordPress, but before you do, it's good to know a little more about what you can expect. There are also some common misconceptions that I see online about JPEG quality, so here goes:

The first misconception many have about JPEG quality is that it is a percentage. It is nothing of the sort. Rather, it is a quality slider, and the values don’t even have to be 1-100. If you’ve used Photoshop, the scale is 1-12, but it operates in a similar way to the typical 1-100 range that is used by WordPress (via GD, Imagick, or GMagick). I say "similar" because every tool is free to interpret the quality levels however they want, and the nature of JPEG compression means that different software often uses different algorithms during compression. This also means that it is impossible to know what quality level was used on a JPEG image unless you know what software created it, and even then it is just an educated guess (some are better than others). The typical quality scale is also not linear, it’s more exponential (although technically I think it might be logarithmic). This means that the higher you go, the less quality improvement there is, but the file size increases dramatically for each increase in quality. Conversely, the lower you go, the faster the quality degrades, and the file size drops less for each step. Typically, a quality between 70 and 90 is preferable to most people, and the value of 82 that WordPress now uses is well within the accepted bounds of quality loss. This is based on a study published by Radware in 2014 where they determined that you could change up to 1.5% of the pixels and an image would still be considered acceptable by users/visitors.

A second problem some folks run into, is that they think setting it to quality 100, or 12 in Photoshop, will disable compression altogether. That just isn’t true, since JPEG is by definition a lossy format. Every single time you re-export or re-save a JPEG file, you will lose pixels, even at maximum quality. The only way to reduce file size, and achieve zero pixel loss, is the lossless compression employed by tools like jpegtran or jhead. Since they don’t alter the image itself, the back-end compression is all that gets altered. It’s similar in nature to how lossless PNG compression works. The pixels are all preserved, the tools just look for optimal compression parameters, which takes more time. Camera manufacturers (and most photo editors) default to a level of compression that trades size for speed. They figure people want their images to save faster, rather than achieving maximum compression. In the case of cameras, battery usage is also a concern, since the extra compression would put a higher strain on the processor, and drain the batter much faster. And I think the camera folks probably have it right, people don’t like to wait for their camera to save an image, they want to get on with taking more pictures, especially since storage is so cheap.

The last misconception is that WordPress decreases the quality of images you upload. WordPress does NOT modify your uploaded images by default. It just transfers them straight to the server, unaltered, and uses that unaltered original to create the resized versions. The resizes are where the quality loss is introduced, and this is where the quality level of 82 comes into play. There is a way that your originals CAN be changed though. If you are using a plugin to resize the uploads to a maximum resolution, then the plugin that does the resizing will be using the default quality of 82, or whatever you have configured. EWWW IO and Imsanity are two such plugins that can be configured to resize your original uploads.

Still need help? Contact Us Contact Us