Thumbnail physical size on server (non palletised output)

Posted in: Newspaper
Post count: 5

Bluntly put, I upload an image (800x600px) of 130k via the media section and the theme-generated thumbnails (741×460 or 768×442) have 700k or 800k respectively.

I DO have WP Smushit plugin active and running.

In my opinion, this situation comes from the fact that while my original image contains a palette, the theme’s generated thumbnails do not. So basically instead of storing a 8-bit index palette for each pixel (such in my original jpg), the thumbnail jpg stores 3x 8-bit true colours for each pixel.

Is there a way to force a palletised thumbnail generation function before the actual output?

I have modified functions.php which is located in the theme folder, in order to compress the thumbnail, then used Force Regenerate, but with basically poor results (in the sense that generated thumbs are still bigger than the original image, despite of their smaller pixel size).

Despite of adding add_filter( ‘jpeg_quality’, create_function(”, ‘return 50;’ ) ); in functions.php and force regenerating thumbs, the results were still

  • This topic was modified 9 years by rudy_roth. Reason: emphasized a statement
Post count: 22421

Hello,

I just tested this on my end. I downloaded a new image of 800×600 and checked the thumb sizes. There was not one that was bigger than the image itself: https://www.screencast.com/t/czCGsrBl
And this is a fresh install with no image optimization added at all. Maybe you have something that affects the images on your end that causes the issue. Please try to disable all plugins and optimization tools used, clear any custom code and clear cache and cdn (do a back-up beforehand though) then try to images again without any external influence.
Let us know how it goes.

Thank you!

Post count: 9544

Look at the docs for imagemagick/GD library on your server, also, as that is what is ‘actually’ making the images from what you upload.

Try doing it without using smush-it; and/or check the settings for that!

Post count: 5

Hi everyone. I have managed to figure out what causes the issue. I have tried without plugins and stuff, but the thing was similar.

I have noticed, however, that not all the files are affected, but only some.

Therefore this situation occurs ONLY with files saved in indexed colour mode.

Indexed colour mode, keeps colour information not within the image pixel data, but stored in a separate palette. As I mentioned early basically instead of storing a 8-bit index palette for each pixel (such in my original PNG), the thumbnail PNG stores 3x 8-bit true colours for each pixel.

If the file is saved in RGB/CMYK mode, the theme works perfectly.

Have a nice day.

  • This reply was modified 9 years by rudy_roth.
Post count: 5

It occurs only when the image is saved in indexed colour mode (such as PNGs). You may create a PNG in Photoshop with these characteristics and try again. In my case, the thumbnails were bigger.

Post count: 22421

Glad you figured it out and thank you for sharing.
Have a great day!

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.