POV-Ray : Newsgroups : povray.binaries.scene-files : sRGB and hexadecimal conversions Server Time
28 Dec 2024 08:32:49 EST (-0500)
  sRGB and hexadecimal conversions (Message 1 to 2 of 2)  
From: Cousin Ricky
Subject: sRGB and hexadecimal conversions
Date: 25 Mar 2014 20:45:00
Message: <web.53322269249b73ca192ae5f10@news.povray.org>
On occasion, I've found the need to take color samples of digital images in
situations such that using the eyedropper tool is too tedious.  POV-Ray's SDL
provides a convenient way to automate this, but POV-Ray's native color format
isn't always the most useful in other contexts.

I wrote an include file that converts linear colors to sRGB, and converts
integers or colors to hexadecimal strings.  It works POV-Ray 3.5 or later, but I
recommend 3.7, as it gives you easier control of image map gamma.  POV-Ray 3.7
also converts from sRGB to linear, which is not part of this include file.

Usage note:  With rare exceptions, I always use assumed_gamma 1.  I do not know
how relevant this file would be for any settings other than 1.


Post a reply to this message


Attachments:
Download 'srgb-inc.zip' (2 KB)

From: Cousin Ricky
Subject: Re: sRGB and hexadecimal conversions
Date: 25 Mar 2015 15:45:16
Message: <5513104c$1@news.povray.org>
On 03/25/2014 08:42 PM, Cousin Ricky wrote:
> On occasion, I've found the need to take color samples of digital images in
> situations such that using the eyedropper tool is too tedious.  POV-Ray's SDL
> provides a convenient way to automate this, but POV-Ray's native color format
> isn't always the most useful in other contexts.
>
> I wrote an include file that converts linear colors to sRGB, and converts
> integers or colors to hexadecimal strings.  It works POV-Ray 3.5 or later, but I
> recommend 3.7, as it gives you easier control of image map gamma.  POV-Ray 3.7
> also converts from sRGB to linear, which is not part of this include file.
>
> Usage note:  With rare exceptions, I always use assumed_gamma 1.  I do not know
> how relevant this file would be for any settings other than 1.

There was a typo in macro sRGB_Convert_c() that made it completely 
unusable.  I don't know how it got past testing.  I have attached a 
corrected file.


Post a reply to this message


Attachments:
Download 'srgb-inc.zip' (2 KB)

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