[Other] [Smush Pro]Some JPGs only compressed by 4 KB. How to re-compress properly?

Hi,
I use Real Media Library to organize our photos within WordPress.  We have approx. 1400 images loaded into approx. 50 separate folders.
 
We are using Smush Pro to compress the images.

I noticed that some images in the media library have been only compressed by a couple of KB.  Most of the images are approx. 800 KB in size, and some have only been compressed to 796 KB.

Most of them have been compressed properly to approx. 30% decrease in size.

Does anybody have any suggestions why this might have happened?

Can I select a single media folder within WordPress, and simply ‘smush’ all of the images in that folder?

Thanks in advance,
Dave

  • Adam Czajczyk
    • Support Gorilla

    Hi David Brocklebank

    I hope you’re well today!

    The compression depends mostly on the image. The lossless (default) compression will usually give relatively “small” savings but if you enable “Super-Smush” (which is lossy) will depend a lot on the size of the image and it’s “complexity”.

    By this I mean that e.g. 5000 x 3000 pixels image that mostly is just a single-color background with a small part of it in few other colors would be compressed way more than a 100×100 pixels images which is “visually complicated’ (has a lot of different details and colors). I’m talking in terms of % of compression but also even in absolute numbers:

    – 10% saving of compression of 2Mb file (so 2048Kb) file will be around 409Kb
    – but 30% (so stronger compression) of 150Kb) file will be just around 45Kb

    so even though compression was stronger it still is less Kb.

    That being said, there are no any hidden/additional compression settings. If you already have super-smush enabled then it’s doing what it can do to compress while maintaining relatively “unchanged” (visually) quality of the image.

    Note also that when you check compression of images in Media Library, it gives you by default a “total” compression but you can click on “View Stats” to see detailed information about specific images (image sizes) where you would see that, for example:

    – thumbnail size image might have been compressed by 3%
    – but medium size one by 10%
    – and full size by 60%

    That’s only example but I just wanted to depict the “idea” behind it.

    Compression also depends on how well the image was optimize before even being uploaded as different apps may output differently compressed files “out of the box”.

    As for compressing folders, you can do it for all folder but not Media Library ones. The option to do this is “Smush Pro -> Directory Smush” and you can select any folders there to get images inside them compressed.

    Folders belonging to Media Library are excluded from that as they are processed by bulk-smushing and/or upon upload if that option is enabled in bulk-smush settings.

    Kind regards,
    Adam

  • David Brocklebank
    • New Recruit

    Hi Adam,
    Thank you for the good explanation.

    But there is something strange in that all photos within 1 particular Media library folder are not being compressed, whereas files in other folders are being compressed.

    I am basing this assumption on the fact that one page on my website has many photos from this library folder, and analyzing that page using GT Metrix shows that many of the images are not compressed at all.

    There are two technical guys who help out with the website, and I am wondering did they somehow have smush pro turned off when I was loading all the images to this library folder… which I would have done on the one day.

    And then the ‘bulk smush’ somehow missed the files in that folder.

    I know at some stage one of the technical guys had Super Smush enabled. But a few of the photos looked a bit fuzzy, and I asked him to turn it off.

    In order to upload any JPGs to my website, I follow the same procedure. I save each image using Photoshop as full resolution at width 1024 pixels before uploading them to the website Media library. Each photo is approx. 850 KB. I have copies of all the photos on my desktop, so I can compare size of originals with those seen by GT Metrix when I analyze to see why a web page might load slowly.

    https://gtmetrix.com/reports/burrenyoga.com/4ely9A3R/

    The first 8 images have not been compressed at all… but the last 2 have been.

    I see most photos are reduced from approx. 850 KB to 300 KB or less… when I view pages using GT Metrix.

    However, photos from this media library (which I would have uploaded all on the same day) are being reduced by approx. 3% to 875 KB. Some of them not being compressed at all.

    We don’t have Super-Smush enabled, as we do want high quality photos displayed on the website.

    Any suggestions?

    Best Wishes,
    Dave

  • Adam Czajczyk
    • Support Gorilla

    Hi David Brocklebank

    Thanks for response and additional explanation!

    In case of sites that require high quality photos “super-smush” may sometimes cause “too much” compression resulting in a bit “fuzzy” image and that’s due to the fact that it is a “lossy compression”. I understand why you may not be able to use it then.

    But that also means that you will not achieve the same compression results as you would with super-smush and in most cases it will trigger GTMetrix/PageSpeed recommendation about images. This is why it’s happening:

    – no super-smush means a lossless optimization which by definition is way less efficient; it only strips “visually irrelevant” data from image files, more of “technical bits” rather than actual pixels, so to say

    – it results in less compression and there’s really not much that could be done about it (except some additional simple steps that I’ll get bet to below)

    – GTMetrix does not do lossless compression when testing; instead it takes an image as and compresses it to 85% of original quality (so again, by definition it assumes quality loss) and if the difference between original and their compressed version is 4KB or more, it reports the image as needing compression

    It does not know/see if the image has really been already compressed or not and it does not “assess” (cannot) quality in the same way as you do (it won’t see that image is becoming “fuzzy” in terms of your standards).

    That can cause some confusion, especially that the recommendation seems to say image was not compressed/optimized at all. In fact, they don’t know that – they just know that compression image to 85% of it’s current quality (as they fetched it form site) would cause saving of 4Kb or more and that’s it.

    That being said, what can be done about that compression without going for lossy compressions (super-smush) so causing quality loss?

    Not much, especially that you already exporting images from Photoshop in “not so big size”. Furthermore, you apparently already serve images (I think using CloudFlare feature) as WebP so that’s a good thing and also helps with image performance.

    However:

    – you may want to check and make sure if you also have “compress uploaded images” option enabled in Bulk Smush settings. By default it’s not enabled and it means that while the additional (smaller) image sizes that WP creates upon upload are compressed, the uploaded original is not; if you enable that option the uploaded original will also be compressed

    – enabling “Strip my image metadata” option can also help a bit (it won’t be significant difference but overall it’s still some additional saving) but that, again, is a “bargain” – it basically removes the EXIF data form image file – so it’s your decision if you need it there or not

    – you can try manipulate WordPress default JPEG quality

    By default WP sets JPEG quality to 86. You can try setting it to lower but you’d need to “experiment” first to find out what number would be lowest acceptable quality (given the fact that you already upload images optimized by Photoshopt and that they are also optimized after upload by Smush and CloudFlare).

    Setting default WP quality is not part of Smush currently but it can be done by adding additional simple code to the site, like this:

    – create empty file with .php extension (e.g. jpeg-quality-custom.php)
    – copy and paste this code into it:

    <?php 
    function custom_jpeg_quality( $quality, $context ) {
    	return 80;
    }
    add_filter( 'jpeg_quality', 'custom_jpeg_quality', 10, 2 );

    – adjust the number 80 (86 is default WP quality; 100 is maximum quality, anything below 86 should result in smaller files but may also degrade visual quality)

    – upload file to the “/wp-content/mu-plugins” folder of the site via FTP or cPanel File Manager or similar way.

    Just note: this will not change already existing files but will affect newly added ones; for existing ones you would need to use plugin like Regnerate Thumbnails to re-create all thumbnails first, then run bulk-smushing again to optimize them again.

    I wouldn’t recommend doing that on live site but rather testing it fist on some staging/dev site first, where you can also find the “compromise” value that’d be lower than default WP quality but still not degrade image quality too much. Only then do full backup for live site and apply it to live site.

    ——————–

    As for some images not being compressed at all, bulk smushing shouldn’t be skipping any images unless

    – given image size is disabled in bulk-smush settings under the “image sizes” option (but that would skip specific-size images from all media library folders rather than some folders only)

    – or if there are images in a folder but they are not actually added to Media Library as in – the files are uploaded but are not registered in DB; that rarely happens unless there’s some custom plugin uploading them that way or they were uploaded directly via FTP

    – or if there’s some conflict with other plugin that breaks it.

    But I’m still not sure if they are actually skipped. If you go to Media Library on site and check those 8 images that are apparently not compressed – what does the stat under “View stats” in Smush column show about them? Can you check that and let me know, please?

    Note: you may want to switch Media Library to “List view” for that and make sure that in “Screen options” tab the “Smush” checkbox is checked:

    [attachments are only viewable by logged-in members]

    Best regards,
    Adam