PDF::Images::Image
Unified image loader that auto-detects format.
This module provides convenience methods to load images from various sources and automatically detect whether they are JPEG or PNG format.
Usage
# Auto-detect format from file extension
image = PDF::Images::Image.load("photo.jpg")
image = PDF::Images::Image.load("logo.png")
# Load from bytes (auto-detects by magic bytes)
image = PDF::Images::Image.load(bytes)
# Load from IO (must specify format or use magic bytes)
image = PDF::Images::Image.load(io)
Constants
JPEG_MAGIC = Bytes[255, 216]
JPEG magic bytes: FF D8
PNG_MAGIC = Bytes[137, 80, 78, 71, 13, 10, 26, 10]
PNG magic bytes: 89 50 4E 47 0D 0A 1A 0A