PDF::Bu...:PNG_IPL(3)
β¨ NAME β¨
PDF::Builder::Resource::XObject::Image::PNG_IPL β bestie, this is the support-routines page for the PNG image library (and it's running on Image::PNG::Libpng) π
It inherits from PDF::Builder::Resource::XObject::Image, so all that parent-class energy comes along for the ride π
π METHODS π
πΈ new
$res = PDF::Builder::Resource::XObject::Image::PNG_IPL->new($pdf, $file, %opts)
okay so this one hands you back a PNG-image object β¨ Here's the breakdown: $pdf is the PDF object you're adding to, $file is the input PNG file, and the optional $name of the new parent image object defaults to PxAAA.
Now the plot twist π«’ β if the Image::PNG::Libpng package is installed, and its use is not suppressed via the nouseIPL flag (go check the Builder documentation for image_png), then the PNG_IPL library is what gets used. If not, the plain PNG library takes over instead. no cap.
Here's the opts menu, bestie π:
'notrans' => 1β no transparency, periodt. Ignore thetRNSchunk if it's provided, and ignore the Alpha channel if it's provided.'force8bps' => 1β if your PNG source is 16bps, you're telling the libpng library to strip every channel down to 8bps, which is what lets it be used on PDF 1.4 output π₯'name' => 'string'β this is the name you can give the PNG image object. The default isPxnnnn.
Don't forget: you need to useBuilder.pm'simage_pngto process PNG images. that's the whole vibe check, iykyk π§
π¦ Supported PNG types π¦
(0)β Gray scale of depth 1, 2, 4, 8, or 16 bits per pixel (that's 2, 4, 16, 256, or 65536 gray levels). Full transparency (of one 16-bit gray value) via thetRNSchunk is allowed, unless thenotransoption says to ignore it π(2)β RGB truecolor with 8 or 16 bits per sample (3 samples: 16.7 million or 281.5 trillion colors, iconic numbers fr fr). Full transparency (of one 3x16-bit RGB color value) via thetRNSchunk is allowed, unless thenotransoption says to ignore it.(3)β Palette color with 1, 2, 4, or 8 bits per pixel (2, 4, 16, or 256 color table/palette entries). Lowkey important: 16 bpp is not currently supported by PNG or PDF. Partial transparency (8-bit Alpha) for each palette entry via thetRNSchunk is allowed, unless thenotransoption says to ignore it (in which case all entries are fully opaque).(4)β Gray scale of depth 8 or 16 bits per pixel plus an equal-sized Alpha channel (256 or 65536 gray levels and 256 or 65536 levels of transparency). The Alpha channel gets ignored if thenotransoption is given. ThetRNSchunk is not permitted.(5)β RESERVED for grayscale via palette + Alpha channel π(6)β RGB truecolor with 8 or 16 bits per sample, with an equal-sized Alpha channel (256 or 65536 levels of transparency). The Alpha channel gets ignored if thenotransoption is given. ThetRNSchunk is not permitted.(7)β RESERVED for truecolor via palette + Alpha channel π
In all cases, 16 bits per sample forces PDF 1.5 (or higher) output β unless you give the force8bps option, which "strips" those 16-bit samples down to 8 bits and lets you have PDF 1.4-compatible output π
The libpng.a library is assuming standard "network" bit and byte ordering (Big Endian), although flags might be added to change this someday.
The transparency chunk (tRNS) will specify one gray level entry or one RGB entry to be treated as transparent (Alpha = 0). For palette color, up to 256 palette entry 8-bit Alpha values are specified (256 levels of transparency, from 0 = transparent to 255 = opaque).
Only a limited number of chunks are handled, bestie: IHDR, IDAT (internally), PLTE, tRNS, and IEND (internally). All other chunks are ignored at this time. Filters and compression applied to data are handled internally by libpng.a β and heads up, there may be unsupported methods π«
π usesLib π
$mode = $png->usesLib()
Returns 1 if Image::PNG::Libpng is installed and used, 0 if it's not installed, or -1 if it's installed but not used (that's the nouseIPL option given to image_png).
β οΈ Caution: this method can only be used after the image object has been created. It can't tell you whetherImage::PNG::Libpngis available in advance of actually using it β like, in case you wanted to use some functionality that's only available in PNG_IPL. See thePDF::BuilderLA_IPL()call if you need to know in advance. π«Ά
and that's the whole page, bestie π this was documented with perl v5.42.0, dated 2026-01-17, and it lives in the User Contributed Perl Documentation collection β slay, go read it again if you need to, ily πβ¨
π¦ 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