I have been facing a problem during conversion in RGB image to CMYK image. I know that the color gamut of these color space are not same. I would like to request you ,could you able to provide the basis algorithm of RGB to CMYK color space, so that I would able understand the conversion process, which will really helpful for my work. Thanking you. With Regards I.Das
closed as off-topic by Scott, Rafael, Luciano, Ovaryraptor, WELZ Feb 8 at 22:01
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not fall within the expertise of graphic designers. This particularly applies to software and hardware questions that are not specific to graphic-design tools – they may be suited for Super User." – Scott, Luciano, Ovaryraptor, WELZ
I assume that you already know RGB numbers control how much red, green and blue light are produced in a pixel of RGB screen. I also assume that you know CMYK numbers control how much cyan, magenta, yellow and black inks are inserted onto paper to make it colored or darker or both. I assume you expect a couple of formulas to convert RGB --> CMYK or reversed. Just two clear and exact formulas with no blahblah.
Unfortunately the blahblah starts now, because there's no unique conversion method. Every RGB display has its own color space (=the collection of produceable colors) and every CMYK print process has its own. You must know the used RGB version and the used CMYK version before any really useful conversion is possible between RGB numbers and CMYK numbers.
You can argue that Photoshop asks nothing, but changes the colors in a second when one changes the used color mode from RGB to CMYK or vice versa. Used versions are hidden to the color settings which define "color management". You find there numerous RGB and CMYK profiles, which actually are complex pieces of computer software and define which is the connection between RGB or CMYK numbers and exact produced (=measured) colors. Photoshop actually even has one color mode which presents measured colors. It's Lab.
To make this all a little more confusing Photoshop can take into the account 4 color profiles in the same time. They are
- one for the camera which took the photo
- one for the space where your current photoshop job lives
- one for your becoming print process
- one for how your monitor displays colors
The last one is actually in the computer operating system. You must calibrate your monitor if you want to have it right. The first one comes as written into the photo file.
You can easily find quick and dirty conversion formulas such as https://www.rapidtables.com/convert/color/rgb-to-cmyk.html and https://www.rapidtables.com/convert/color/cmyk-to-rgb.html
They do not at all take into the account the used devices. They have a reasonable principle to select as high percentage of black ink K as possible to remove redundant C, M and Y inks and they surely show white paper with no ink at all when R=G=B=255. But for any realistic print preparation those formulas are poor. They assume a CMYK system which can produce exactly the same colors as your RGB screen and make a linear transformation between them (=linear after inserting as much K as possible).
In reality the used conversion must be highly non-linear for decent results. That non-linearity is written into color profiles.
When you understand all this, you may also understand why Adobe collects millions and millions despite the existence of GIMP. The latter knows nothing of CMYK printing altough it allows you to set colors with CMYK numbers.
I am not sure you understand the question. I will try more than answering it, to explain what must be understood about color modes.
RGB and CMYK are not really color spaces, they are color modes. But I will not dive into it too deep.
The conversion from RGB to CMYK should be made ONLY if you need it, which making a totally imaginary loose guess is a tiny fraction of the times people think they should. Imagine there are 100 color printers in peoples offices, homes, etc. They all most likely do NOT need, and should not use CMYK.
2.1 You only need it if you are using some specific specialized printing service, normally for mass production, like offset sheeted lithography, or in some really limited cases some specific commercial digital services... (Which I have almost never encountered)
The RGB to CMYK in these particular cases (see 2.1) is not to cause problems... it is to solve them. The conversion is not meant to "Lose colors", it is meant to "simulate them when printed on a limited (printed) medium"
This "simulation" is made accordingly to some stuff called color profile, which is a series of parameters (matrixes and functions) to control the conversion which renders two things...
4.1 The amount of ink each plate (CMY&K) should have... according to a set of rules, for example, maximum accepted ink on the paper (or medium) TAC (Total area of Coverage), Dot gain, type of paper, absorption of ink, brand of ink (or the intended specification), transparency of it, etc.
4.2 How to simulate this on your application so you have an idea how it will look when printed.
As these conversions imply a squishy-squashy of the shape of the "color solid" there are different sub-methods to do it, depending on what do you want to preserve more. Colorimetric, relative colorimetric, relative something stuff vs some other colorimetric something stuff.
The conversion also can imply jumping into a 3rd color mode, Lab for example.
But you also can make some other conversions, like swapping RGB to CMY channels, changing the number of inks involved, and a big etcetera.
Sayed that... No. I do not know how the "algorithm" works None of the previous is the algorithm... (the algorithm uses these parameters) But I do not need it. I only need to understand when to use what. :o)
You need to implement a color management system. Photoshop does not really do the color conversion it asks a CMS to do it for Photoshop. The system allows you to choose which CMS to use. You can use Adobes CMS, apples CMS, microsofts CMS etc...
You should also defer the job to a CMS engine. Why? Well because you will need to implement color profile to color profile conversion. This is quite much work since you need to write a tool that can undstand and execute different versions of ICC profile standards. Since each ICC profile is sort of a mini programming language, or at least a complex format, so this task is time consuming.
We simply can not give a formula. Because there is no formula. There is a system that allows you to describe the system you have and letting the system combine 2 of these formulas for a transform. You need the entire system.
Use your operating systems CMS, or use something like tiny CMS.