WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#42128 new defect (bug)

PNGs lose color space information when resized

Reported by: joemcgill Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

In cases where a PNG image is RGB but contains no color pixels, ImageMagick is converting the image to a gray color model during resizing, which makes the image look dark and blocky.

I'm uploading a few of original example images, saved as both PNG8 and PNG24 and one without an alpha channel.

Based on these examples, this seems to only affect PNG images and transparency doesn't seem to matter.

Attachments (4)

coin-png24.png (285.0 KB) - added by joemcgill 2 years ago.
PNG 24 no alpha
coin-png24-alpha.png (279.0 KB) - added by joemcgill 2 years ago.
PNG 24 with alpha
coin-png8-alpha.png (178.0 KB) - added by joemcgill 2 years ago.
PNG 8 with alpha
coin-png24-300x300.png (50.0 KB) - added by joemcgill 2 years ago.
PNG 24 no alpha (after resize)

Download all attachments as: .zip

Change History (6)

@joemcgill
2 years ago

PNG 24 no alpha

@joemcgill
2 years ago

PNG 24 with alpha

@joemcgill
2 years ago

PNG 8 with alpha

@joemcgill
2 years ago

PNG 24 no alpha (after resize)

#1 follow-up: @yingling017
2 years ago

I did some testing with this and was not able to recreate this issue in ImageMagick Version ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31. I was able to recreate the issuse in ImageMagick Version ImageMagick 6.7.7-10 2017-07-31 Q16.

#2 in reply to: ↑ 1 @joemcgill
2 years ago

Replying to yingling017:

I did some testing with this and was not able to recreate this issue in ImageMagick Version ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31. I was able to recreate the issuse in ImageMagick Version ImageMagick 6.7.7-10 2017-07-31 Q16.

Thanks @yingling017, confirming that I was testing using ImageMagick 6.7.7-10 2017-02-22 Q16 so this may very well be an ImageMagick bug.

Note: See TracTickets for help on using tickets.