php convert rgb to cmyk

Posted on 2011-04-27
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'm also attaching a before and after of the color space conversion.

Do you know why the colors are reversing? before CMYK After CMYK
Question by:spoggles
    LVL 14

    Accepted Solution


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

    Assisted Solution

    Apparently this is due to a shift from positive to negative colorspace as discussed here: and
    LVL 14

    Expert Comment


    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.
    LVL 107

    Assisted Solution

    by:Ray Paseur
    I want to convert the QR code to CMYK for printing purposes -- are you sure this is even necessary?  
    LVL 12

    Assisted Solution

    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?


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now