Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Imagick CMYK to SRGB conversion #28809

Merged

Conversation

tdgroot
Copy link
Member

@tdgroot tdgroot commented Jun 19, 2020

Add Imagick CMYK to SRGB conversion

Description (*)

When Imagick adapter detects that the opened image has a CMYK colorspace, convert the colorspace to SRGB.

Related Pull Requests

  1. Adds color conversion to SRGB for images with CMYK palette #25277

Fixed Issues (if relevant)

  1. Fixes CMYK images are rendered with inverted colors #22375

Manual testing scenarios (*)

  1. Set Imagick as the image adapter
  2. Create a product and configure the following file:
    image
  3. The colors on the frontend of the resized image should be correct.

Questions or comments

Not sure if the CMYK image added to the unit test has any copyrights to it. @ioweb-gr Can you confirm if the image can be used for this purpose?

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jun 19, 2020

Hi @tdgroot. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@krisdante
Copy link
Contributor

The test is here, that's a fact. But the test is not testing what this problem is all about.
IMO the test shall be extended and do the color probe of some pixel, and check that this color probe in actually orangish not blueish

@tdgroot
Copy link
Member Author

tdgroot commented Jun 22, 2020

The test is here, that's a fact. But the test is not testing what this problem is all about.
IMO the test shall be extended and do the color probe of some pixel, and check that this color probe in actually orangish not blueish

I do not completely agree with you. While it would be very thorough to test if the image pixels are corrected, this is not completely Magento territory. That is, because Magento should not test if Imagick is doing its work.

It IS Magento's responsibility to convert the color space when it detects CMYK color space, so that actually needs to be tested to verify the conversion takes place, which is to be seen by checking the getColorspace method and comparing it to the getOriginalColorspace method.

@sidolov sidolov added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 14, 2020
@gabrieldagama
Copy link
Contributor

The risk was set tomedium due to: the suggested changes are made on the framework and may affect other areas or cause undesired behavior.

/**
* @var \Imagick
*/
protected $_imageHandler;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need this var? It should be inherited from the parent class

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It provides type information for within the ImageMagick class.

@engcom-Golf
Copy link
Contributor

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-8296 has been created to process this Pull Request
✳️ @sidolov, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Bravo engcom-Bravo self-assigned this Oct 2, 2020
@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

Manual testing scenario

  1. Install ImageMagick image processor + php extension installed (sudo apt install php-imagick)
  2. From Magento Admin, go to Stores - Configuration - Advanced - Developer, expand, Image Processing Settings
  3. Set Image Adapter to ImageMagick.
    Selection_153
    Save Config and clear Magento Cache
  4. Go to **Catalog - Products, click Add Product
  5. Fill in all required fields, set Category
  6. Expand Images And Videos and upload a CMYK color image
    ima_vid_sett
  7. Save the product and assert that the color is original, not inverted
  8. Go to Storefront and check the previously created products image

BEFORE applying the changes provided in this PR, the color of CMYK images was inverted
thumb
prod_page
Peek 2020-10-02 11-01

AFTER switching to this PR, the newly added CMYK Product images are displayed correctly on Storefront
after1
after2

@engcom-Bravo engcom-Bravo added the QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope label Oct 2, 2020
@sidolov sidolov added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Oct 2, 2020
@magento-engcom-team magento-engcom-team merged commit 615c89c into magento:2.4-develop Oct 6, 2020
@m2-assistant
Copy link

m2-assistant bot commented Oct 6, 2020

Hi @tdgroot, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Image Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Risk: medium Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

CMYK images are rendered with inverted colors
7 participants