1

I have noticed that WP does have the bad habit of recompressing Full Size images during uploads. I mean, it does make sense creating several smaller versions of each uploaded image, applying a default 90% JPEG quality setting, but why compressing twice also the Full Size images, as they are fine just as they are?

My problem is that usually 90% of the large JPEGs I'm uploading through WP are usually set to a 50-75% quality to decrease their size, so when WP re-compress them it causes a further loss in quality and their size is being bloated between 100-200%.

Is there any way to keep WP from changing the size and quality of Full Size JPEGs?

2
  • Could you explain what you're talking about more precisely? Because as far as I'm aware, the "full size" images are saved as the original uploads, and are not recompressed at all. A quick test seems to confirm this for me, so I'd need to know what exactly you are seeing.
    – Otto
    Nov 27, 2012 at 18:30
  • BTW, "large" is not the same as "full size", WP creates three (or more) versions of large images uploaded to it. But the original one is always left as-is as far as I can see.
    – Otto
    Nov 27, 2012 at 18:32

1 Answer 1

1

Using a filter for jpg_quality will hellp you to set your quality for uplaoded images.

add_filter('jpeg_quality',  create_function('$n', 'return 70;'));

In most good implementations of Image Optimization you can find a various usae of ImageOptimization tools such as optimng/jpegtran etc, there a lot of plugins that help you to do that.

4
  • Thanks Code Monkey for the reply - but your function just sets the JPEG quality setting, and that means that if I upload a Full Size image, that would be recompressed anyway with the quality set, with further degratation of the image. The point is: why is there no way to avoid a forced recompression of a full size image that's already perfect as it is? Nov 27, 2012 at 10:48
  • Original Image which you reffering to not changed. literaly... its same as it was before you select it to upload. check hashes of files if you don't belive. Nov 27, 2012 at 14:07
  • No, it's not. Tried it right now. Uploaded a 2600x1868 pixel JPEG image. The original size was 693,576 bytes. After having uploaded it, the Full Size image as saved by Wordpress has become 1,920,080 bytes. It's a 277% increase in size, as you can see... Nov 27, 2012 at 14:46
  • In this case you have something else that changing image size. Wordpress Native code dosn't to that. its just moving uploaded file to uplaods folder and pass it to thumbnails generation function. Do you have any image optimzation modules? (its posible to catch uplaoded file and change it as that tools do.) Nov 27, 2012 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.