Renato Santos de Souza >
RGB2HSI >
RGB2HSI

Module Version: 0.012
RGB2HSI

version 0.1

use RGB2HSI; # this may die on input higher than 1 my ($h, $s, $i) = rgb2hsi( 0.704, 0.187, 0.896 ) # $h is between 0 and 360 # $s is saturation between 0 and 1 # $i is intensity between 0 and 1

Convert RGB colors float (0..1) to HSI using this method:

Suppose R, G, and B are the red, green, and blue values of a color. The HSI intensity is given by the equation

I = (R + G + B)/3.

Now let m be the minimum value among R, G, and B. The HSI saturation value of a color is given by the equation

S = 1 - m/I if I > 0, or S = 0 if I = 0

You can use IUP::ColorDlg to convert RGB to HSI (HEX too) but it's too big to install if you only need RGB2HSI !

RGB2HSI - Convert RGB color to HSI (hue saturation intensity) color-space

Renato Cron <renato@aware.com.br>

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: