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)
Sourcecolor_space
PDF color space name (/DeviceRGB, /DeviceGray, /DeviceCMYK)
Sourcehas_alpha?
Whether this image has transparency (alpha channel)
Sourcesoft_mask_stream
Returns the soft mask stream for transparency (if applicable)
Sourceto_stream
Returns the encoded image data stream for embedding
Sourceto_xobject
Build the Image XObject dictionary
Source