Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Using Imager getpixel

by tonyc (Pilgrim)
on Jan 03, 2012 at 04:42 UTC ( #945999=note: print w/replies, xml ) Need Help??

in reply to Re^2: Using Imager getpixel
in thread Using Imager getpixel

I'll improve it, both the handling of supplying a scalar and ref in x, y and diagnostics for different array lengths.

If you can work row-by-row instead of column-by-column, you might want to consider using getscanline() or getsamples() instead of getpixel().

Replies are listed 'Best First'.
Re^4: Using Imager getpixel
by Anonymous Monk on Sep 22, 2014 at 17:16 UTC
    my $image_file = "a.bmp"; my $img = Imager->new(file => $image_file) or die Imager->errstr; my @color = 0; $szerokosc = $img->getwidth(); $wysokosc = $img->getheight(); print"wymiar $szerokosc, $wysokosc\n"; for($x=0;$x<=$szerokosc - 1;$x++){ for($y=0;$y<=$wysokosc - 1;$y++){ my $color = $img->getpixel( x => $x, y => $y ); my ( $r, $g, $b, $a ) = $color->rgba(); print " shade = $r, $g, $b\n"; } } <>;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2016-10-25 14:09 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (320 votes). Check out past polls.