PDF::Builder::Resource::XObject::Image::PNG_IPL(3)

NAME
PDF::Builder::Resource::XObject::Image::PNG_IPL - support routines for PNG image library (using Image::PNG::Libpng). Inherits from PDF::Builder::Resource::XObject::Image

METHODS

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

    Returns a PNG-image object. $pdf is the PDF object being added to, $file is the input PNG file, and the optional $name of the new parent image object defaults to PxAAA.

    If the Image::PNG::Libpng package is installed, and its use is not suppressed via the "nouseIPL" flag (see Builder documentation for "image_png"), the PNG_IPL library will be used. Otherwise, the PNG library will be used instead.

    opts:

    'notrans' => 1
        No transparency -- ignore tRNS chunk if provided, ignore Alpha channel if provided.

    'force8bps' => 1
        If the PNG source is 16bps, tell the libpng library to strip down all channels to 8bps, permitting use on PDF 1.4 output.

    'name' => 'string'
        This is the name you can give for the PNG image object. The default is Pxnnnn.

    Remember that you need to use Builder.pm's image_png to process PNG images.

  Supported PNG types
   (0) Gray scale of depth 1, 2, 4, 8, or 16 bits per pixel (2, 4, 16, 256,
       or 65536 gray levels). Full transparency (of one 16-bit gray value)
       via the tRNS chunk is allowed, unless the notrans option specifies
       that it be ignored.

   (2) RGB truecolor with 8 or 16 bits per sample (3 samples: 16.7 million
       or 281.5 trillion colors). Full transparency (of one 3x16-bit RGB
       color value) via the tRNS chunk is allowed, unless the notrans
       option specifies that it be ignored.

   (3) Palette color with 1, 2, 4, or 8 bits per pixel (2, 4, 16, or 256
       color table/palette entries). 16 bpp is not currently supported by
       PNG or PDF. Partial transparency (8-bit Alpha) for each palette
       entry via the tRNS chunk is allowed, unless the notrans option
       specifies that it be ignored (all entries fully opaque).

   (4) Gray scale of depth 8 or 16 bits per pixel plus equal-sized Alpha
       channel (256 or 65536 gray levels and 256 or 65536 levels of
       transparency). The Alpha channel is ignored if the notrans
       option is given. The tRNS chunk is not permitted.

   (5) B<RESERVED> for grayscale via palette + Alpha channel

   (6) RGB truecolor with 8 or 16 bits per sample, with equal-sized
       Alpha channel (256 or 65536 levels of transparency). The Alpha
       channel is ignored if the notrans option is given. The tRNS
       chunk is not permitted.

   (7) B<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, to "strip" 16 bit samples to 8 bits, and permit 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.

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: IHDR, IDAT (internally), PLTE, tRNS, and IEND (internally). All other chunks are ignored at this time. Filters and compression applied to data is handled internally by libpng.a -- there may be unsupported methods.

  usesLib
    $mode = $png->usesLib()

    Returns 1 if Image::PNG::Libpng installed and used, 0 if not installed, or -1 if installed but not used (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 whether Image::PNG::Libpng is available in advance of actually using it, in case you want to use some functionality available only in PNG_IPL. See the PDF::Builder LA_IPL() call if you need to know in advance.