Opened 21 months ago
Last modified 2 months ago
#47840 new enhancement
Weird colors when users upload CMYK JPG images
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | 5.2.2 |
Component: | Media | Keywords: | needs-patch |
Focuses: | ui | Cc: |
Description (last modified by )
When a user uploads an image which uses the CMYK color spectrum and WordPress applies its magic to the image the colors become very much mixed up.
It would be nice if WordPress would recognize the image format and perhaps convert the CMYK image to an RGB before applying the image optimizations.
How to reproduce the problem?
- Go to Gallery (media)
- Upload a JPG image which uses the CMYK color spectrum
- Watch how e.g. the color green becomes yellow ;)
Attachments (1)
Change History (5)
#3
@
21 months ago
I uploaded the test image file to multiple wordpress instances on different servers / providers - it always bugs out. Sometimes the guys' shirt is yellow, sometimes the image becomes extremely dark.
#4
@
2 months ago
Imagick has a setColorSpace method that can address this issue
so we could add this in WP_Image_Editor_Imagick class
<?php class WP_Image_Editor_Imagick extends WP_Image_Editor { [...] /** * Sets Image Color Space * * * @param int $colorSpace Color Space * @return true|WP_Error True if set successfully; WP_Error on failure. */ public function set_color_space($colorSpace = null) { if ('image/jpeg' === $this->mime_type) { try { $this->image->setColorSpace($colorSpace); } catch (Exception $e) { return new WP_Error('image_color_space_error', $e->getMessage()); } } return true; }
Note: See
TracTickets for help on using
tickets.
WordPress doesn't actually have any code to do images on that level, it uses the available libraries already installed on the host, like GD or ImageMagick, to do that grunt work.
So, if something is wrong there, then you need to identify specifically which versions of which libraries are causing the issue. Workarounds might be found, but you'd need to identify them and provide example images that can reproduce the problem.