Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 2 weeks ago

#58960 closed defect (bug) (duplicate)

Core cannot handle indexed 8bit PNG, severe implications on filesize and website speed

Reported by: tgsrvrs's profile tgsrvrs Owned by:
Milestone: Priority: normal
Severity: major Version: 6.2.2
Component: Media Keywords: reporter-feedback
Focuses: Cc:

Description

After countless hours of investigating, testing and searching the web I came to the conclusion that WP is not able to handle color indexed 8bit PNGs properly.
The calculated downscaled images are not only a few bytes, but severely bigger than the original.

This results out of my conclusion and tests that WP is generating full-spectrum grayscale images out of the indexed files.

As you cannot simply deactivate srcset and other functionality for dedicated files this leads to a plethora of problems I consider severe. Way bigger files, srcset problems and ultimately website speed problems. Because of this nature this can only be handled in core. Or if there is any other workaround please tell me.

We are not talking marginal numbers here, baseline is a 256 color 8bit indexed PNG

17% downscale : 328% filesize
58% downscale : 204% filesize
79% downscale : 148% filesize

Wordpress 6.2.2, no plugins enabled


Active editor	WP_Image_Editor_Imagick
ImageMagick version number	1809
ImageMagick version string	ImageMagick 7.1.1-15 Q16-HDRI x86_64 21298 https://imagemagick.org
Imagick version	3.7.0

Replication possibility : Always, just upload an indexed PNG to the media library
Result : Severely bigger files for the downscaled images than the original file

Example :
Original file : 45 kB
1180x685 downscale : 148kB
600x348 downscale : 92kB
300x174 downscale : 67kB

Although this has no security implications or the like I consider this a major bug as there is nothing you can do as a user to circumvent the results in any way.

Attachments (1)

Test.png (44.2 KB) - added by tgsrvrs 18 months ago.

Download all attachments as: .zip

Change History (7)

#1 @tgsrvrs
18 months ago

There was an error in my reports actually for 600 and 300 filesizes sorry.

17% downscale : 328% filesize
58% downscale : 148% filesize
79% downscale : 55% filesize

Original file : 45 kB
1180x685 downscale : 148kB
600x348 downscale : 67kb
300x174 downscale : 25kB

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


18 months ago

#3 follow-up: @antpb
18 months ago

  • Keywords reporter-feedback added
  • Milestone changed from Awaiting Review to Future Release

Thanks for this ticket @tgsrvrs ! Would it be possible for you to share the source image that you are using that causes this? It would help greatly in reproducing it as you have found.

@tgsrvrs
18 months ago

#4 in reply to: ↑ 3 @tgsrvrs
18 months ago

Replying to antpb:

Thanks for this ticket @tgsrvrs ! Would it be possible for you to share the source image that you are using that causes this? It would help greatly in reproducing it as you have found.

sure, uploaded as an attachment, I have countless of them if you need more but I think that should do it just fine

#5 @antpb
18 months ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Actually, it looks like we have an open issue for this tracking in #53408.

I'm going to close this one and link to the duplicate to keep the focus on one issue. Thank you for your report and the test image @tgsrvrs !

Note: See TracTickets for help on using tickets.