Skip to content

xyz_from_rgb not works #3

Description

@ChameleonRed
from colorpy import colormodels as cm

class ColorPy(object):
  @staticmethod
  def irgb2lab(r, g, b):
    irgb = cm.irgb_color(r, g, b)
    rgb = cm.rgb_from_irgb(irgb)
    xyz = cm.xyz_from_rgb(rgb)
    lab = cm.lab_from_xyz(xyz)
    return lab

  @staticmethod
  def rgb2lab(r, g, b):
    rgb = cm.rgb_color(r, g, b)
    xyz = cm.xyz_from_rgb(rgb)
    lab = cm.lab_from_xyz(xyz)
    return lab

  @staticmethod
  def rgb2xyz(r, g, b):
    rgb = cm.rgb_color(r, g, b)
    xyz = cm.xyz_from_rgb(rgb)
    return xyz

Try to convert gray rgb_color(.5, .5, .5) should be near ('xyzColorMath', '0.203 0.214 0.233') but is ('xyzColorPy', '0.475 0.500 0.545').
http://www.easyrgb.com/index.php?X=CALC#Result
http://www.workwithcolor.com/

(('rgb', (0.5, 0.5, 0.5), [128.0, 128.0, 128.0]),
 ('xyzColorPy', '0.475 0.500 0.545'),
 ('xyzColorMath', '0.203 0.214 0.233'),
 ('labColorPy', '76.069 0.000 0.000'),
 ('labColorMath', '53.389 -0.000 -0.005'))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions