WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 7 months ago

#39331 new defect (bug)

unsharpMaskImage in Imagick's thumbnail_image is not compatible with CMYK jpegs.

Reported by: gitlost Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.5
Component: Media Keywords:
Focuses: Cc:

Description

This has been split off from #39216.

The use of Imagick::unsharpMaskImage() in WP_Image_Editor_Imagick::thumbnail_image() on jpegs with CMYK color spaces results in mangled images, eg black text becomes fuzzy and over-black, and colors change. The attached patch just doesn't call it if the image has a CMYK color space.

The unit test requires the attached "test_cmyk.jpg" to be uploaded to the test data images directory (which is actually the "full" jpeg produced by WP_Image_Editor_Imagick when processing the "test_cmyk.pdf" PDF uploaded to #39216).

Attachments (3)

39331.patch (1.7 KB) - added by gitlost 11 months ago.
Don't call unsharpMaskImage() if CMYK color space.
test_cmyk.jpg (32.9 KB) - added by gitlost 11 months ago.
Test CMYK jpeg. Needs to uploaded to tests data image directory.
39331.2.patch (2.2 KB) - added by gitlost 7 months ago.
Refresh and fix, with ImageMagick version check.

Download all attachments as: .zip

Change History (6)

@gitlost
11 months ago

Don't call unsharpMaskImage() if CMYK color space.

@gitlost
11 months ago

Test CMYK jpeg. Needs to uploaded to tests data image directory.

#1 @gitlost
11 months ago

Looks like it's probably this ImageMagick bug 299 - after manually updating ImageMagick on Ubuntu 16.10 to 6.9.6-8 (the standard package is at 6.8.9-9) then convert test_cmyk.jpg -unsharp 0.25x0.25+8+0.065 out.jpg works correctly, whereas before it didn't.

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


7 months ago

@gitlost
7 months ago

Refresh and fix, with ImageMagick version check.

#3 @gitlost
7 months ago

On investigating #40537, can confirm that this affects ImageMagick versions 6.8.4-0 to 6.9.6-4 as mentioned in the ImageMagick bug 299 (or at least can confirm it on testing versions 6.8.3-10, 6.8.4-10, 6.9.6-4 and 6.9.6-5 - couldn't find any releases from 6.8.4-0 to 6.8.4-9 to test). So affects the Ubuntu ImageMagick packages that come with Vivid 15.04, Wily 15.10, Xenial 16.04 and Yakkety 16.10.

The new patch refreshes and fixes the old patch which was broken anyway, and adds a check to only apply the workaround for these ImageMagick versions.

Note: See TracTickets for help on using tickets.