Image::PNM - parse and generate PNM (PBM, PGM, PPM) files
version 0.01
use Image::PNM; my $image = Image::PNM->new("image.pbm"); my $pixel_value = $image->pixel(1, 2); open my $fh, '>', 'new_image.ppm'; $fh->print($image->as_string("P3")); # convert to rgb format
This module can read and write images in any of the PNM formats (PBM, PGM, or PPM).
Creates a new image object. If $data is a string, it is interpreted as a filename to open, otherwise if it is a scalar reference, it is interpreted as a reference to a string containing the contents of a PNM file. If it is not passed at all, a new PNM file is created with width and height of 1, a max pixel value of 1, and the sole pixel having value 0.
$data
Converts the image object into a PNM format (given by the required argument). Returns the PNM data as a string.
Returns the width of the image in pixels. If $w is given, sets the width of the image to $w.
$w
Returns the height of the image in pixels. If $h is given, sets the height of the image to $h.
$h
Returns the maximum value allowed for a pixel. Pixel values must be integers, and they are interpreted as being scaled by this value.
Returns the value of a pixel at the given $row and $col. The value is returned as an arrayref of three RGB values, where each value ranges from 0.0 to 1.0.
$row
$col
0.0
1.0
Returns the value of a pixel at the given $row and $col. The value is returned as an arrayref of three RGB values, where each value is an integer ranging from 0 to $image->max_pixel_value.
0
$image->max_pixel_value
Please report any bugs to GitHub Issues at https://github.com/doy/image-pnm/issues.
You can find this documentation for this module with the perldoc command.
perldoc Image::PNM
You can also look for information at:
MetaCPAN
https://metacpan.org/release/Image-PNM
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Image-PNM
Github
https://github.com/doy/image-pnm
CPAN Ratings
http://cpanratings.perl.org/d/Image-PNM
Jesse Luehrs <doy@tozt.net>
This software is Copyright (c) 2014 by Jesse Luehrs.
This is free software, licensed under:
The MIT (X11) License
To install Image::PNM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::PNM
CPAN shell
perl -MCPAN -e shell install Image::PNM
For more information on module installation, please visit the detailed CPAN module installation guide.