[wp-trac] [WordPress Trac] #57003: Compress original image upload to avoid uncompressed images

WordPress Trac noreply at wordpress.org
Mon Nov 7 22:04:11 UTC 2022


#57003: Compress original image upload to avoid uncompressed images
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  2nd-opinion needs-patch needs-unit-  |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------

Comment (by azaozz):

 > the originally uploaded image is still used as is in many cases (when it
 is smaller than the "big image" threshold).

 Yes, it is. This covers the cases where the originally uploaded image is
 already prepared for use on the internet, either has been edited by the
 user or was downloaded from somewhere.

 > - Always generate a new image from the originally uploaded image, even
 when it is not a "big" image.
 > - Once the image has been generated, compare the file size...

 I agree, this will potentially reduce the size of many images. However it
 will also degrade the quality, perhaps quite a bit in some cases.

 The general assumption is that smaller images are ready for use on the
 internet (are not photos coming straight from a camera). This seems to be
 the most common case. If WP re-compresses them, the file size will likely
 be smaller. However the loss of quality of an image going through second
 lossy compression is usually significant.

 Nevertheless I think introducing some functionality to re-compress images
 and compare file sizes would be a nice addition. If an image is not ready-
 for-internet, the compressed copy would be quite smaller.

 Perhaps can try to set a threshold of how smaller the new file must be in
 order to "archive" the original and use the newly created image instead.
 Of course it should still err on the side of quality, i.e. the image
 created by WP should be significantly slammer in file size, perhaps > 30%.

 Having said all that, adding one more "processing" of uploaded images
 would slow down the overall process. Perhaps it won't introduce more
 uploads failures as only smaller images will be processed, but still
 thinking something like this will be best to implement after WP can make
 image sub-sizes "on the fly". Ideally this functionality will be dependent
 on removing the image post-processing bottleneck.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57003#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list