class

PDF::Images::Base

Inherits Reference < Object

Abstract base class for image handlers.

Images are embedded in PDFs as XObject resources with /Subtype /Image. Different image formats (JPEG, PNG) require different handling:

  • JPEG: DCT passthrough (raw bytes embedded directly)
  • PNG: Decoded to RGB/RGBA and re-encoded with FlateDecode

Instance methods

bits_per_component

Bits per color component (typically 8)

Source
color_space

PDF color space name (/DeviceRGB, /DeviceGray, /DeviceCMYK)

Source
has_alpha?

Whether this image has transparency (alpha channel)

Source
height
Source
soft_mask_stream

Returns the soft mask stream for transparency (if applicable)

Source
to_stream

Returns the encoded image data stream for embedding

Source
to_xobject

Build the Image XObject dictionary

Source
width

Image dimensions

Source