icc icon indicating copy to clipboard operation
icc copied to clipboard

Converting an rgb color to a cymk color following an icc profile

Open asturur opened this issue 3 years ago • 3 comments

I know this is a common question, i googled a bit i could not find anything. I see there is a PR open that adds more parsing to this library, and i was wondering if those tags are somehow related to the color conversion.

If they are i'm willing to pick up the work where it was left and move forward.

I would kindly ask, if you know, if with some extra work this library can become a color converter using the information contained in the color profile.

thanks.

asturur avatar Jul 10 '20 10:07 asturur

This module is designed to parse profiles rather than provide any conversion logic.

http://www.littlecms.com/ is the "gold standard" for colour management.

The A2B and B2A tags contain look-up-tables (LUTs), which we can definitely expose - happy for a PR to do this.

Profiles usually relate to a specific colourspace, e.g. RGB or CMYK, rather than about conversion between them. Perhaps you need something like https://www.npmjs.com/package/color ?

lovell avatar Jul 10 '20 14:07 lovell

Well maybe i miss some bit of knowledge.

My specific problem is convet rgb to cymk .... (<---not an issue) ... following the iso coated v2 300% profile (<--- this is the part i do not know how to do it )

I thought that the color profile include necessary information for this conversion to happen correctly, and i thought that extracting data from the color profile is part of the process.

I also thought that LUTs are how this happen.

How much i am far from the truth?

asturur avatar Jul 10 '20 15:07 asturur

https://www.color.org/icc32.pdf I think you need to read this specification document in order to understand what Mr lovell has said in his previous comment. Plus, I also would like would like to expose matrice tables that are used for conversion. From everything that I have read, this is what I have understood: CMYKVector = matriceMultiplication(conversionMatrice, rgb vector) where rgbVector is 3 dimensional vector (i.e. one rgb pixel) CmykVector is a 4 dimensional vector (i.e. one CMYK vector) conversionMatrice is a 3x4 matrix which seems to be the A2B “tag” but that am not sure yet.

Also I am not even sure that we use a matrix and its inverse matrix for cmyk ==> rgb or rgb=> cmyk

i have also downloaded the official profile inspector from the icc organization https://www.color.org/profileinspector.xalter But it is still very unclear for me how exactly this is working: is the matrix even constant for a given rgb pixel??

Well, i have just seen that this post is from july 2020 but I will just keep it here if anyone has the same questions or even answers!

edit: the mathematical model is explained in page 50 of the icc profile specification

Aminelahlou avatar Apr 27 '23 22:04 Aminelahlou