gtaylor / python-colormath

A python module that abstracts common color math operations. For example, converting from CIE L*a*b to XYZ, or from RGB to CMYK
python-colormath.readthedocs.org
BSD 3-Clause "New" or "Revised" License
456 stars 82 forks source link

Converting LAB to CMYK issue #116

Closed besmirzekaj closed 1 year ago

besmirzekaj commented 1 year ago

Hello,

I am trying to convert LAB to CMYK, when i try to validate it with online converters the result is different:

INPUT:

from colormath.color_objects import LabColor, CMYKColor from colormath.color_conversions import convert_color

lab = LabColor(10,10,2) CMYK = convert_color(lab, CMYKColor)

OUTPUT:

LabColor(lab_l=10.0, lab_a=10.0, lab_b=2.0, observer='2', illuminant='d50') CMYKColor(cmyk_c=0.0, cmyk_m=0.4539692246798778, cmyk_y=0.38035882154170325, cmyk_k=0.8407781933210968)

But when i use online converter i have the below values:

C: 0 M: 0.4570569197749976 Y: 0.38817420761385446 K: 0.8391917765589244

How can i fix it ?

Thanks in Advance,

BR,

Besi

gtaylor commented 1 year ago

Hello! I'm not familiar with the converter you linked. No idea why it'd be different, but I don't have the gumption to dig into their code. Let me know if something ends up wrong on the colormath, but I'll go on ahead and close this as not presently actionable.

besmirzekaj commented 1 year ago

Hi !

Thanks for your reply.

I tried also on other convertors online, the result is with all the same, but in the colormath the result is as described.

gtaylor commented 1 year ago

That makes sense, though there are a lot of factors to compare across each of these. Defaults may vary, slightly different numbers may be used for illuminants/constants, etc. I'd be happy to accept a PR if you (or anyone) found an issue, but I don't have the gumption to dig into this :(