• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2394
  • Last Modified:

php convert rgb to cmyk

Hello Experts!

I am using Imagick to convert a QR generated from Google Charts to the Color space CMYK. I want to convert the QR code to CMYK for printing purposes. However, when I convert the QR code, the black turns into white and the white turns into black.

This is the code I'm using:
$i = new Imagick($imgFileName);

I'm also attaching a before and after of the color space conversion.

Do you know why the colors are reversing? before CMYK After CMYK
  • 2
  • 2
4 Solutions

Hope this article will give you the correct idea about the cause:

Apparently this is due to a shift from positive to negative colorspace as discussed here:
http://stackoverflow.com/questions/4830478/php-imagick-rgb-to-cmyk-inverts and
here http://imagemagick.org/Usage/formats/#color_profile.

I got the same converted image after using your code, that is both the images are same in my case. May be you have to check the GD library information for this.
Ray PaseurCommented:
I want to convert the QR code to CMYK for printing purposes -- are you sure this is even necessary?  
The negative image evaluates to the same URL as the positive image, so there may not be any reason to be concerned and a talk with your printer to see if this is an issue may bring a practical resolution to your problem.

Have you tried the methods outlined at the links I posted above? If so, what was the outcome?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now