Highlighted

RGB to gray conversion

Community Beginner ,
Nov 12, 2020

Copy link to clipboard

Copied

Hi Everyone!,

Is there is any mathematical function/formula to convert RGB/Hex to gray color conversion?

for example, 

if the we have red color FF0000 [ 255,0,0] and convert into gray 7f7f7f [127,127,127]

 [ 255,0,0] this value changed to [127,127,127]

Anyone colud explain this conversion?

TOPICS
Actions and scripting

Views

75

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

RGB to gray conversion

Community Beginner ,
Nov 12, 2020

Copy link to clipboard

Copied

Hi Everyone!,

Is there is any mathematical function/formula to convert RGB/Hex to gray color conversion?

for example, 

if the we have red color FF0000 [ 255,0,0] and convert into gray 7f7f7f [127,127,127]

 [ 255,0,0] this value changed to [127,127,127]

Anyone colud explain this conversion?

TOPICS
Actions and scripting

Views

76

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
Nov 12, 2020 0
Adobe Community Professional ,
Nov 12, 2020

Copy link to clipboard

Copied

Hi

I don't understand any of this but have a look here 😁

https://www.rapidtables.com/convert/color/how-rgb-to-hex.html

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
Reply
Loading...
Nov 12, 2020 0
Community Beginner ,
Nov 12, 2020

Copy link to clipboard

Copied

Hi Ged,

Thank you for the prompt reply.

I need to know RGB to grey color conversion of formula/functionalities 

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
Reply
Loading...
Nov 12, 2020 0
Adobe Community Professional ,
Nov 12, 2020

Copy link to clipboard

Copied

Those numbers depend on what the RGB color space is, and what the grayscale color space is. Yes, grayscale is subject to standard color management just like RGB. It's just one channel instead of three. RGB color spaces are sRGB, Adobe RGB and so on; grayscale color spaces are Dot Gain 15%, Gray gamma 2.2, sGray etc.

 

Numbers are color space specific. This is important to understand. Any given color will yield different numbers in different color spaces. Any given set of numbers will yield  different colors in different color spaces. This applies to grayscale as much as RGB (or CMYK).

 

Hex is just a convenient way to express RGB numbers. It has no significance beyond convenience.

 

If you just use Image > Mode, the grayscale profile is determined by whatever you have as working gray. It's better to convert directly to the grayscale profile you want, with Edit > Convert to Profile. You should be aware that the default gray in Photoshop, Dot Gain 20%, is virtually useless for any practical purpose. The problem is that outside Photoshop, grayscale color management support is virtually non-existent. So while everything looks fine in Photoshop, all conversions performed as they should - the moment you move that file outside Photoshop, you get massive tone and contrast changes.

 

In converting from RGB to grayscale, you get the least surprises if you pick a grayscale profile with the same tone response curve as the RGB profile. So you'd use sRGB > sGray, Adobe RGB > Gray Gamma 2.2, and ProPhoto > Gray Gamma 1.8. If you do that, the numbers should stay reasonably consistent.

 

There is still the problem of what to do with the grayscale file outside Photoshop, because almost no software on the planet will treat it correctly. The grayscale profile will largely be ignored, even in applications that otherwise are fully color managed. The safest one all over is probably Gamma 2.2.

 

The simple answer, which is the one I usually give, is: avoid grayscale if you can. It's a minefield, and the likelihood of getting a nasty surprise is very high. For screen use, a monochrome sRGB file is always safe(r).

 

For offset CMYK print, grayscale traditionally and by convention prints on the black plate only (saving money). So it has a purpose there, and there are ways to control the result by converting to <black ink> CMYK. But that's a different and longer story.

 

 

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
Reply
Loading...
Nov 12, 2020 0
Adobe Community Professional ,
Nov 13, 2020

Copy link to clipboard

Copied

If using the Image > Mode menu options, then Edit > Colour Settings controls the conversion.

 

* Source RGB profile, either assigned or assumed

* Destination Greyscale profile

* Rendering intent, engine, BPC etc.

 

If using Edit > Conver to Profile then the same rules apply, it is all about the selected settings.

 

Numbers such as 255r0g0b and 127r127g127b are just values, until an ICC profile is paired with them the exact colour and tone is variable.

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
Reply
Loading...
Nov 13, 2020 0