[wp-trac] [WordPress Trac] #47840: Weird colors when users upload CMYK JPG images

WordPress Trac noreply at wordpress.org
Thu Feb 18 07:22:45 UTC 2021


#47840: Weird colors when users upload CMYK JPG images
-------------------------+------------------------------
 Reporter:  lexo_ch      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:  5.2.2
 Severity:  minor        |  Resolution:
 Keywords:  needs-patch  |     Focuses:  ui
-------------------------+------------------------------

Comment (by olivM):

 Imagick has a setColorSpace method that can address this issue

 so we could add this in WP_Image_Editor_Imagick class

 {{{#!php
 <?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;
     }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47840#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list