I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-06-17 02:47:45.119772-07 by tonyc in response to 12778
Re: how to get the coordinates of certain pixel based on color

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.

Direct Responses: 12784 | Write a response