Documentation
¶
Overview ¶
Package imaging decodes images for PDF embedding. JPEG is embedded losslessly via DCTDecode (original bytes passed through); PNG is decoded and re-encoded with FlateDecode, its alpha channel becoming a soft-mask (SMask). The result is ready to write as an image XObject.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct {
Width, Height int
ColorSpace string // "DeviceRGB", "DeviceGray", or "DeviceCMYK"
BitsPerComponent int
Filter string // "DCTDecode" or "FlateDecode"
Data []byte // XObject stream data (already filtered)
SMask []byte // optional 8-bit gray alpha, FlateDecode-compressed
Format string // "jpeg" or "png"
}
Image is a decoded image ready to embed as a PDF XObject.
func DecodeDataURI ¶
DecodeDataURI decodes a data: URI (base64 or raw payload).
func Load ¶
Load resolves an image source and decodes it. The source may be a data: URI, an http:// or https:// URL, or a local file path; any other URI scheme is rejected with a descriptive error.
Click to show internal directories.
Click to hide internal directories.