Make WordPress Core

Opened 16 months ago

#57781 assigned enhancement

Exclude sized variant from SRCSET if larger in file size than the original image

Reported by: abitofmind's profile abitofmind Owned by: adamsilverstein's profile adamsilverstein
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.1.1
Component: Media Keywords:
Focuses: Cc:



Every here and then some anomalies may occur where a sized image variant, which is smaller in image dimensions than its original, may nevertheless be larger in file size than the original. Some examples were shown in #57238.


The goal of #57238 is to improve the rulesets/algorithm that this is less likely to happen. And continue to improve if new edge cases get reported.

WP Media has no mechanism to alter the outcome of the sized image variants (e.g. multi pass optimization like rerun with different parameters until sized version is smaller in file size).

But if that situation nevertheless happens there is still an easy "last safety net" we can make use of.

Goal of this very ticket

  • The original will always be better in quality (natural law, unless a sized variant gets improved by artificial intelligence).
  • If a sized variant is larger in file size than the original, it makes no sense to offer it, hence exclude it from the SRCSET.
  • Possibly not only the first sized variant may be larger in file size, but potentially more (was the case in #57238). All those variants shall be excluded.

Extra goal

If such an incident is detected on a real world WordPress instance, it would be ideal if the WordPress dev team could learn from it and potentially improve the algorithm accordingly.


  • In WordPress > Settings > Media
    • [√] Allow to send analytical data when image optimizations fails
  • In WordPress > Dashboard > Site Health: Hint + action links
    • "We detected X images where the smaller sized responsive images were larger than the original."
    • Show affected images and Report to WordPress team to improve the image optimizations.
  • For both situations we would need a "show me more" disclaimer text, which would be like:

Note: WordPress has clever responsive image algorithms. Still occasionally there may be a situation where a very optimized original results in resized images which oddly are larger in file size. With this check you allow to transmit the URLs of such affected images to the WordPress development team, so that we can study them and improve WordPress accordingly. The images will be purely used for analytical purposes and your image rights remain unaffected. No other data than the URLs of the images get transmitted.

Change History (0)

Note: See TracTickets for help on using tickets.