[wp-trac] [WordPress Trac] #53408: png images bit depth is modified in resized images

WordPress Trac noreply at wordpress.org
Tue Jun 15 11:27:40 UTC 2021


#53408: png images bit depth is modified in resized images
--------------------------+-----------------------------
 Reporter:  wpfed         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.7.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi,

 When I upload a 8 bit png image graphic, WordPress resizes as usual but
 modifies the bit depth to 24 or 32 bit, depending if their is a alpha
 channel. Without Alpha channel it is 24bit, with it's 32bit.

 The problem with that is that the file sizes end up being multiple times
 bigger than the original image.

 I opened a ticket with ImageMagick
 https://github.com/ImageMagick/ImageMagick/discussions/3825

 Some of the replies included these solutions:

 **Setting bit-depth to 8 in the way done in the script may not be adequate
 for PNG. I think the only way to ensure that is to preface the output name
 with PNG8:filename.png. But I am not sure if it will preserve you
 transparency if the input has transparency. But the best thing to resolve
 that would be simply to try it.**

 **Scaling the image, depending upon the scaling method, most likely will
 add more colors than the 256 limit for 8-bit color. So the image has to be
 forced to quantize colors to the 256 limit in order to save as 8-bits.
 Otherwise, it is saved as 24 or 32-bits. So specifying PNG8:filename.png
 will save as 8-bits.**

 PNG00:  Inherit PNG color and bit depth from input
 image(https://legacy.imagemagick.org/Usage/formats/#png_formats)

 Also here are related tickets I was able to find:

 https://core.trac.wordpress.org/ticket/36477
 https://core.trac.wordpress.org/ticket/30402
 https://core.trac.wordpress.org/ticket/48736

 Thanks!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53408>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list