Scroll to navigation

PDF::Builder::Resource::XObject::Image::PNM(3pm) User Contributed Perl Documentation PDF::Builder::Resource::XObject::Image::PNM(3pm)

NAME

PDF::Builder::Resource::XObject::Image::PNM - support routines for PNM (Portable aNy Map) image library. Inherits from PDF::Builder::Resource::XObject::Image

METHODS

new

    $res = PDF::Builder::Resource::XObject::Image::PNM->new($pdf, $file, %opts)

Options:
'name' => 'string'
This is the name you can give for the PNM image object. The default is Nxnnnn.
'compress' => 1
This is the compression you can give for the PNM image object. Any value will cause the use of Flate compression, otherwise ("compress" not given), ASCIIHexDecode is used.

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.

For bi-level, only values 0/1 (white/black) are supported. 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, one byte of raw binary data per pixel, otherwise two bytes. For RGB, each sample (full-on of that color) may be anything from 1 to 65535 (the same maximum for all three colors), with 0 being full black. If the maximum sample value is 255 or smaller, three bytes of raw binary data per pixel, otherwise six bytes.

Remember that you need to use Builder.pm's image_pnm method to use this functionality.

2023-12-15 perl v5.36.0