[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

php convert rgb to cmyk

Posted on 2011-04-27
5
Medium Priority
?
2,217 Views
Last Modified: 2012-05-11
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
Comment
Question by:spoggles
  • 2
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
shobinsun earned 500 total points
ID: 35478684
HI,

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

http://www.printernational.org/rgb-versus-cmyk.php
0
 
LVL 12

Assisted Solution

by:Amick
Amick earned 1000 total points
ID: 35478698
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
 
LVL 14

Expert Comment

by:shobinsun
ID: 35478740
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
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 500 total points
ID: 35483664
I want to convert the QR code to CMYK for printing purposes -- are you sure this is even necessary?  
0
 
LVL 12

Assisted Solution

by:Amick
Amick earned 1000 total points
ID: 35484644
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question