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