in reply to RGB values and color name
You should be able to use Graphics::ColorNames in conjunction with GD to achieve the desired result.
Added:
#!/usr/bin/perl use strict; use warnings; use Graphics::ColorNames qw( hex2tuple ); use GD; our %COLORS; tie %COLORS, 'Graphics::ColorNames'; my $img = new GD::Image(100, 100); foreach my $color (keys %COLORS) { $img->colorAllocate( hex2tuple( $COLORS{$color} ) ); } my $apricot = $img->colorClosest(255,200,180); print "\$apricot is supposed to be 255 200 180 but is actually @{[$img +->rgb($apricot)]}\n"; my $reddish = $img->colorClosest(223,8,13); print "\$reddish is supposed to be 223 8 13 but is actually @{[$img->r +gb($reddish)]}\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: RGB values and color name
by mdog (Pilgrim) on Aug 25, 2003 at 20:23 UTC |