in reply to Perl Image Analysis

I thought Image::Magick had a method to read a pixel color but, I could not find one. But GD does - The only problem, GD doesn't seem to handle TIF natively, so you may have to do a conversion to an uncompressed JPEG or PNG.

From the GD Docs:

$index = $image->getPixel(x,y) object method This returns the color table index underneath the specified point. + It can be combined with rgb() to obtain the rgb color underneath the + pixel. Example: $index = $myImage->getPixel(20,100); ($r,$g,$b) = $myImage->rgb($index);


grep
One dead unjugged rabbit fish later

Replies are listed 'Best First'.
Re^2: Perl Image Analysis
by LTjake (Prior) on Oct 04, 2006 at 19:43 UTC

    Or, perhaps they could use Imager. It has a getpixel method:

    my $color = $img->getpixel(x=>50, y=>70);

    ...and can read TIFF files (given the existence of libtiff).

    --
    "Go up to the next female stranger you see and tell her that her "body is a wonderland."
    My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
    " (src)

Re^2: Perl Image Analysis
by Koosemose (Pilgrim) on Oct 04, 2006 at 20:37 UTC

    Actually you were right, Image::Magick does have a method to query pixel color:

    $image->Get('Pixel[x,y]')

    It returns a scalar value containing a comma seperated list R,G,B,A. There's also $image->GetPixels(), but I've had some issues getting accurate color readings from it, though that's likely an error on my part.

    Just Another Perl Alchemist