POV-Ray : Newsgroups : povray.general : color conversion : Re: color conversion Server Time
19 Jun 2024 07:29:52 EDT (-0400)
  Re: color conversion  
From: Alain Martel
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

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