POV-Ray : Newsgroups : povray.general : color conversion Server Time
23 Nov 2024 20:37:27 EST (-0500)
  color conversion (Message 1 to 3 of 3)  
From: David Kraics
Subject: color conversion
Date: 3 Aug 2022 12:35:00
Message: <web.62eaa29175d93abf1c1b6180a57e0@news.povray.org>
Hello. I need help with something. For years I believed that to convert a color
from 255 scale to decimal, you just divide the rgb number by 255. But I've come
to realize that isn't how to do it. I'm trying to convert a shade of green on a
photo. The numbers weren't coming out right. I tested my method on colors in the
colors.inc file and came out with different results. For instance, I reverse
converted Gray50 (which is .5,.5,.5) and came up with 127.5. I rendered a block
with the color, and then used Paint Shop Pro to grab the rgb color, from the
produced picture, and it reported 177. I tried doing a google search for a
converter, but they all wanted to convert the three rgb numbers into a single
decimal number. So how do I convert RGB numbers into decimals to use in POV=ray?


Post a reply to this message

From: Alain Martel
Subject: Re: color conversion
Date: 3 Aug 2022 13:06:18
Message: <62eaab0a$1@news.povray.org>
Le 2022-08-03 à 12:30, David Kraics a écrit :
> Hello. I need help with something. For years I believed that to convert a color
> from 255 scale to decimal, you just divide the rgb number by 255. But I've come
> to realize that isn't how to do it. I'm trying to convert a shade of green on a
> photo. The numbers weren't coming out right. I tested my method on colors in the
> colors.inc file and came out with different results. For instance, I reverse
> converted Gray50 (which is .5,.5,.5) and came up with 127.5. I rendered a block
> with the color, and then used Paint Shop Pro to grab the rgb color, from the
> produced picture, and it reported 177. I tried doing a google search for a
> converter, but they all wanted to convert the three rgb numbers into a single
> decimal number. So how do I convert RGB numbers into decimals to use in POV=ray?
> 

When you have a colour using a 0..255 range, you normally have to assume 
that it's in the sRGB colour space.
The colour picker from Photoshop do work in the sRGB colour space.

So, you should use the srgb keyword.
Don't forget to use assumed_gamma 1 in your global_settings.

pigment{ srgb Picked_Colour/255 }


Post a reply to this message

From: Bald Eagle
Subject: Re: color conversion
Date: 3 Aug 2022 15:30:00
Message: <web.62eacca0938293031f9dae3025979125@news.povray.org>
"David Kraics" <bar### [at] aolcom> wrote:
> Hello. I need help with something. For years I believed that to convert a color
> from 255 scale to decimal, you just divide the rgb number by 255. But I've come
> to realize that isn't how to do it. I'm trying to convert a shade of green on a
> photo. The numbers weren't coming out right. I tested my method on colors in the
> colors.inc file and came out with different results. For instance, I reverse
> converted Gray50 (which is .5,.5,.5) and came up with 127.5. I rendered a block
> with the color, and then used Paint Shop Pro to grab the rgb color, from the
> produced picture, and it reported 177. I tried doing a google search for a
> converter, but they all wanted to convert the three rgb numbers into a single
> decimal number. So how do I convert RGB numbers into decimals to use in POV=ray?

Welcome to the wonderful world of srgb.  ;)

If you use srgb as a search term, I'm sure you'll find that many of us have
encountered this and beaten the subject very nearly to death.

https://news.povray.org/povray.general/thread/%3Cweb.60649d9bb9b7dccdd98418916e066e29%40news.povray.org%3E/?mtop=433484
&moff=32


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.