Opened 3 weeks ago
Closed 4 days ago
#65922 closed defect (bug) (fixed)
regression: client-side processing creates thumbnails larger than original for indexed PNG images
| Reported by: | nosilver4u | Owned by: | adamsilverstein |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1.1 |
| Component: | Media | Version: | 7.1 |
| Severity: | normal | Keywords: | has-unit-tests has-patch |
| Cc: | Focuses: | performance |
Description
When uploading an indexed PNG image in WP 7.1, we found that all of the thumbnails are saved with an RGBA color type instead of indexed/palette. As discussed in #36477, this causes the thumbnail to have much larger sizes than they ought to, and often larger than the original.
For example, in the image I've attached, the original is 200kb, but a 1024px (large) version is 216kb, while the 1536px version is a whopping 444kb. This is in contrast to thumbs generated with ImageMagick, where the large version is 70kb and the 1536 is only 111kb.
Attachments (1)
Change History (13)
#3
@
3 weeks ago
That rabbit-time-paletted-or8.png image is in the test suite already.
There tests should verify that the thumbnails are small and also that the thumbnails are paletted.
#5
@
3 weeks ago
Testing a fix in https://github.com/WordPress/gutenberg/pull/81884.
#6
@
3 weeks ago
- Keywords has-unit-tests has-patch needs-testing added
- Milestone Awaiting Review → 7.1.1
- Status reviewing → accepted
Reproduced with the attached image. The palette chunk is reason: libvips decodes an indexed PNG into full RGB(A) pixels, and nothing in the client-side pipeline was asking pngsave to quantise back down, so every sub-size got written as truecolour.
libvips does flag the source encoding - a PNG loaded from an indexed original carries a palette metadata field - so the fix is to check that and pass palette: true on save. Gated on the source, so a truecolour PNG is never quantised.
The PR also includes some e2e tests.
@nosilver4u / @siliconforks can you give that a test?
in the meantime if this is causing an issue for you, use media library uploads (which still use the server processing) or install my disable-client-side-media plugin (from wordpress.org).
#9
@
3 weeks ago
Thanks for testing @nosilver4u - I'm fine tuning the approach in the PR based on feedback and will plan to have this be part of the next point release.
#10
@
6 days ago
The fix for this was merged in https://github.com/WordPress/gutenberg/pull/81884.
This ticket was mentioned in Slack in #core by adrianduffell. View the logs.
4 days ago
#12
@
4 days ago
- Resolution → fixed
- Status accepted → closed
This will get fixed in core for 7.1.1, it is included in the list of backport being included: https://github.com/WordPress/gutenberg/pull/82383
Closing this one for now, feel free to re-open if it isn't resolved in 7.1.1.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
indexed PNG image