If you know its grayscale...
function GrayScaleToHex( $val ) {
$norm = $val * 2.55 + $val/100;
$hex = sprintf("%02X", $norm);
return '#' . $hex . $hex . $hex;
}
Should get you close enough.
Matt
Ren� fournier wrote:
> Anyone know how I might convert a grayscale value, from between 0 to
> 100, to hex, such that 0 (black) would be returned as #000000, and 100
> (white) as #FFFFFF? For example...
>
> function grayscaletohex ($val) {
> $hex = $val ... [ a simple operation ]
> return $hex;
> }
>
> Thanks.
>
> ...Rene
>
> ---
> Ren� Fournier,
> [EMAIL PROTECTED]
>
> Toll-free +1.888.886.2754
> Tel +1.403.291.3601
> Fax +1.403.250.5228
> www.smartslitters.com
>
> SmartSlitters International
> #33, 1339 - 40th Ave NE
> Calgary AB T2E 8N6
> Canada
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php