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 83 forks source link

Add AppleRGBColor #59

Closed jan-warchol closed 8 years ago

jan-warchol commented 8 years ago

First of all: very nice library, thanks a lot for publishing it!

I need to do some transformations from sRGB to Apple RGB, so why not add AppleRGBColor class?

I have copied transformation matrices from http://www.brucelindbloom.com/Eqn_RGB_XYZ_Matrix.html#WSMatrices and the other constants (illuminant and gamma) from http://www.brucelindbloom.com/index.html?WorkingSpaceInfo.html#ColorSets

As far as I can tell this is the same Apple RGB space as is available in Adobe Photoshop.

I hope I did this right - I'm pretty new to color space transformations... Let me know if something's wrong.

Thanks!

gtaylor commented 8 years ago

Hello @janek-warchol ! Thanks for sending this in.

This is looking pretty good. If I can just get a test case for XYZ to/from Apple RGB, we'll go on ahead and merge this.

Here's a link to the XYZ to RGB case for Adobe RGB: https://github.com/janek-warchol/python-colormath/blob/master/tests/test_color_objects.py#L98

If you have any additional ideals for cases to cover, feel free to toss them in as well.

Thanks for the pull request!

jan-warchol commented 8 years ago

Hello,

sure! I'm running into some issues with roundtrip conversion producing unexpected results - probably I'm doing something wrong - so it may take me a day or two to produce the test case, but I'll get back to you :-)

jan-warchol commented 8 years ago

Hi again @gtaylor ! The test is done.

gtaylor commented 8 years ago

Excellent. I haven't had a ton of time to test this myself, but I'm going to go on ahead and merge this so we can get it in other people's hands as well. It passes the eyeball test, and we can iterate as need be prior to a full PyPi release.

I'm without internet at home, pending Comcast not being crappy. Once that gets set up, I should be able to get the release cut.

jan-warchol commented 8 years ago

Great, thanks!