| | 545 | |
| | 546 | /** |
| | 547 | * @ticket 39331 |
| | 548 | */ |
| | 549 | public function test_cmyk_jpg_resize() { |
| | 550 | $test_file = DIR_TESTDATA . '/images/test_cmyk.jpg'; |
| | 551 | $save_to_file = tempnam( get_temp_dir(), '' ) . '.jpg'; |
| | 552 | |
| | 553 | $editor = new WP_Image_Editor_Imagick( $test_file ); |
| | 554 | $editor->load(); |
| | 555 | $editor->resize( 106, 150 ); // Default thumbnail size. |
| | 556 | $editor->save( $save_to_file ); |
| | 557 | |
| | 558 | // Use GD as Imagick seems to do some color mapping of CMYK images. |
| | 559 | $gd_image = imagecreatefromjpeg( $save_to_file ); |
| | 560 | // Not sure how system-independent this is. |
| | 561 | // Pixel (15, 10) should be white. |
| | 562 | $output = dechex( imagecolorat( $gd_image, 15, 10 ) ); |
| | 563 | imagedestroy( $gd_image ); |
| | 564 | $this->assertSame( 'ffffff', $output ); |
| | 565 | |
| | 566 | unlink( $save_to_file ); |
| | 567 | } |