Image-Pixels The pixels of a PNG, JPEG, GIF, BMP or WebP file. Image::Pixels turns the bytes of a picture's file into its pixels: four bytes a pixel, a row at a time from the top, whatever kind of file they came from. use Image::Pixels qw(decode decode_file info); my $picture = decode_file('photo.jpg'); printf "%s, %d by %d\n", @{$picture}{qw(format width height)}; my ($red, $green, $blue, $solid) = unpack 'C4', $picture->{rgba}; my $about = info($bytes); decode and decode_file give the kind of file, its width, its height and its pixels, or undef for bytes that are not a picture drawn here. The pixels are the picture as the file stores it and are never turned. info gives the kind and the size with nothing decoded, and how a JPEG says it is to be turned. A picture with more pixels than the caller allows is refused before any room is made for it. encode and encode_file turn pixels back into a file: a PNG, a BMP or a WebP, each of which keeps every pixel as it was, a JPEG, which keeps a picture that looks the same in far fewer bytes, or a GIF, which keeps a picture of 256 colours or fewer and cuts the colours of any other to 256. A file is written whole beside its name and then renamed, so there is never half a picture under the name. It links no library: every decoder is in this distribution. It needs Ex::Op to run and ExtUtils::Depends to build. Another extension can ask for pixels from C, and have a picture written, with no Perl call between and nothing linked, through one installed header, imgpix_abi.h. The header says how. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install A C compiler is needed. `make ctest` builds and runs the engine with no perl. SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Image::Pixels You can also look for information at: RT, CPAN's request tracker (report bugs here) https://rt.cpan.org/NoAuth/Bugs.html?Dist=Image-Pixels Search CPAN https://metacpan.org/release/Image-Pixels LICENSE AND COPYRIGHT This software is Copyright (c) 2026 by LNATION . This is free software, licensed under: The Artistic License 2.0 (GPL Compatible)