Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Convert RGB to an actual color

by Zaxo (Archbishop)
on Nov 20, 2002 at 05:12 UTC ( #214357=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use GD;
    
    sub getindex {
    ...
           $image->colorAllocate(@_) :
                $index;
    }
    
  2. or download this
    my $reference_image = new GD::Image(100,100);
    my @colornames;
    {
    ...
        }
        close $rgbdat or die $!;
    }
    
  3. or download this
    my $image = GD::Image->newFromJpeg('many.jpg') or die $!;
    my @size = $image->Bounds();
    
  4. or download this
    my $new_image = GD::Image->new @size;
  5. or download this
    {
        my ($ix, $iy, @rgb);     # preallocate and reuse
        for $ix (0 .. $size[0]-1) {
    ...
            }
        }
    }
    
  6. or download this
    sub getcolor {
        return "puke" unless @_ == 3;
        $colornames[$reference_image->colorClosestHWB(@_)]
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://214357]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2019-07-17 18:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?