[wp-trac] [WordPress Trac] #48842: Fix calculation error when resampling images before resizing in class-wp-image-editor-imagick.php

WordPress Trac noreply at wordpress.org
Tue Dec 3 23:47:23 UTC 2019


#48842: Fix calculation error when resampling images before resizing in class-wp-
image-editor-imagick.php
---------------------------------------+---------------------
 Reporter:  azaozz                     |       Owner:  (none)
     Type:  defect (bug)               |      Status:  new
 Priority:  high                       |   Milestone:  5.4
Component:  Media                      |     Version:  4.5
 Severity:  normal                     |  Resolution:
 Keywords:  2nd-opinion needs-testing  |     Focuses:
---------------------------------------+---------------------

Comment (by vanyukov):

 Replying to [comment:7 azaozz]:

 >Looking at the ImageMagick code, it also has a hard-coded scale factor of
 5 but does the resampling for a bit smaller sub-sizes, $resize_ratio <=
 0.1. This still upscales when images are resized to between 32% to 20% of
 the original.

 Yeah, looks like WordPress implementation is almost identical to the
 {{{ThumbnailImage}}} in ImageMagick.
 >On the other hand quickly testing this with the sample 10MB JPEG image in
 ImageMagick 7.0.9 (PHP 7.3), the sub-size images that were resized
 "directly" without the 5x scaling are either identical or a little smaller
 in file size, up to about 2% smaller. This will need a lot more testing
 but seems that ImageMagick perhaps handles JPEGs better in newer versions?

 The difference is probably due to a different filter being used. It looks
 like the default one for ImageMagick is FILTER_MITCHELL, while WordPress
 is using FILTER_TRIANGLE

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


More information about the wp-trac mailing list