PDF::Bu...age::PNM(3)
π NAME π
PDF::Builder::Resource::XObject::Image::PNM β support routines for the PNM (Portable aNy Map) image library, bestie π
It inherits from PDF::Builder::Resource::XObject::Image, so it's literally part of the family, no cap π«Ά
π METHODS π
β¨ new β¨
okay so this is the moment, the main character constructor:
$res = PDF::Builder::Resource::XObject::Image::PNM->new($pdf, $file, %opts)
Options, because of course there are options, and we're gonna go through every single one π
'name' => 'string'β this is the lil name you can give your PNM image object π·οΈ the default isNxnnnnif you don't say anything.'compress' => 1β this is the compression you can give your PNM image object. Any value at all will make it use Flate compression, otherwise (so, if"compress"isn't given), ASCIIHexDecode is used. Not me being like "any value, even a lie, counts" π it's true tho.
Returns an image in the PDF β¨ PNM types 1 (ASCII/plain bi-level/PBM), 2 (ASCII/plain grayscale/PGM), 3 (ASCII/plain RGB/PPM), 4 (binary/raw bi-level/PBM), 5 (binary/raw grayscale/PGM), and 6 (binary/raw RGB/PPM) are supported. all six, we ate π₯
For bi-level, only values 0/1 (white/black) are supported. that's it. that's the whole menu π
For grayscale, the maximum sample (full white) may be anything from 1 to 65535, with 0 being full black. If the maximum sample value is 255 or smaller, that's one byte of raw binary data per pixel, otherwise it's two bytes. math is mathing π
For RGB, each sample (full-on of that color) may be anything from 1 to 65535 (and yes, the same maximum for all three colors, they're matching, iconic), with 0 being full black. If the maximum sample value is 255 or smaller, that's three bytes of raw binary data per pixel, otherwise six bytes. six. bytes. periodt.
π bestie, do NOT forget β you need to useBuilder.pm'simage_pnmmethod to use this functionality. like, this whole module is lowkey useless without it, iykyk.
sign-off time π¦ this page is from perl v5.42.0, dated 2026-01-17, and it's part of the PDF::Builder era β mwah, go make some pretty PDFs, you got this πβ¨
π¦ where this page comes from
- fedora 44: perl-PDF-Builder 3.028-2.fc44 Β· LGPL-2.1-or-later AND LGPL-2.1-only AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms