One way that might work is to call getscanline() in scalar context and use a regular expression to scan for the colour you need:
# assume 4 channel image, this will need to change depending on the number of channels
# untested
# note: index() won't work since it will return entries not aligned on a pixel boundary
my $re_color = join('', map sprintf("\\x%02x]", $_), $find_color->rgba);
my $re = qr/^((?:....)*)$re_color/;
for my $y (0 .. $im->getheight()-1) {
my $row = $im->getscanline(y => $y);
if ($row =~ $re) {
print "Found ", length($1) / 4, ", $y\n";
last;
}
}
Otherwise you could use the API from Inline::C or XS. |