Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


How exactly does Photoshop do RGB-to-Lab and Lab-to-RGB conversions?

Explorer ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

I have read all the equations and and stuff from Bruce Lindbloom's site about color spaces. I wrote my own program to test this out, implememnting every part of the equations found on his site, but I get different results from Photoshop's Lab processing. I created a test picture in photoshop (which I saved as a BMP file called Untitled-1a.bmp), and then, I wrote a program that performs all the steps described on Lindbloom's website.

First, it converts the 0-255 integer range of RGB values to a 0-1 floatingpoint range of RGB values.

Then it converts from normal (gamma corrected) RGB to linear RGB.

Then it converts from linear RGB to XYZ using the D65 sRGB color matrix (there's also a D50 version, but the official sRGB specification uses the D65 reference white, so that's the one I'm using).

Then it converts RGB to Lab.

After that my program performs some editing in Lab space, specifically it clear's the lightness channel to black, just as a test.

Then it performs all the reverse conversions from Lab back to XYZ, and then to RGB, and then gamma corrects that to non-linear RGB, and finally scales the values back into the 0-255 range.

It then saves an output image from that result as a BMP file (called Untitled-1b.bmp).

 

I did the same thing in Photoshop, by taking the same sample image, and setting the color mode to Lab, clearing the lightness channel, and then setting the color mode back to RGB. I then saved the result as a BMP file (called Untitled-1c.bmp).

 

When you look at those 2 pictures, which are edited in the same way (both the Untitled-1b variant and the Untitled-1c variant), you will notice a huge difference in their appearance. So either Photoshop is not performing the color space conversions correctly, or else Lindbloom's website has some technical errors in its equations. I've attached all 3 of my pictures here to this post.

TOPICS
Bug, Problem or error

Views

38

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

LATEST

Color management? Sounds like you left out the one critical part for any high-fidelity/ full gamut processing....

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines