Why not adopt me?
NAME
Image::PNM - parse and generate PNM (PBM, PGM, PPM) files
VERSION
version 0.01
SYNOPSIS
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
DESCRIPTION
This module can read and write images in any of the PNM formats (PBM, PGM, or PPM).
METHODS
new($data)
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.
as_string($format)
Converts the image object into a PNM format (given by the required argument). Returns the PNM data as a string.
width($w)
Returns the width of the image in pixels. If $w
is given, sets the width of the image to $w
.
height($h)
Returns the height of the image in pixels. If $h
is given, sets the height of the image to $h
.
max_pixel_value
Returns the maximum value allowed for a pixel. Pixel values must be integers, and they are interpreted as being scaled by this value.
pixel($row, $col, $new_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
.
raw_pixel($row, $col, $new_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 is an integer ranging from 0
to $image->max_pixel_value
.
BUGS
Please report any bugs to GitHub Issues at https://github.com/doy/image-pnm/issues.
SEE ALSO
SUPPORT
You can find this documentation for this module with the perldoc command.
perldoc Image::PNM
You can also look for information at:
MetaCPAN
RT: CPAN's request tracker
Github
CPAN Ratings
AUTHOR
Jesse Luehrs <doy@tozt.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Jesse Luehrs.
This is free software, licensed under:
The MIT (X11) License