All pastes #261375 Raw Edit

Someone

public text v1 · immutable
#261375 ·published 2006-11-29 04:43 UTC
rendered paste body
sub process {
    my $image = shift @_;
    my $bmp = Image::BMP->new();
    $bmp->open_file($image);
    print $bmp->xy(3,3);

    my $width        = $bmp->{Width};
    my $height       = $bmp->{Height};
    my $total_pixels = $width * $height;

#   my $pixels[$width][$height];
    my @pixels;

    #Read it into an array
    for my $x ($width) {
        for my $y ($height) {
	    my $hsv = rgb_to_hsv(( $bmp->xy_rgb( $x, $y  )));
	    $pixels[$x]->[$y] = $hsv;
        }
    }
    print Dumper(@pixels);
    return ( $total_pixels, \@pixels );
}