• 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->setImageFormat('jpg');
$i->setImageColorspace(Imagick::COLORSPACE_GRAY);
$i->writeImage($newFileName);

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
0
spoggles
Asked:
spoggles
  • 2
  • 2
4 Solutions
 
shobinsunCommented:
HI,

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

http://www.printernational.org/rgb-versus-cmyk.php
0
 
AmickCommented:
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.
0
 
shobinsunCommented:
hi,

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.
0
 
Ray PaseurCommented:
I want to convert the QR code to CMYK for printing purposes -- are you sure this is even necessary?  
0
 
AmickCommented:
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?


0
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