module HexaPDF::ImageLoader::JPEG

This module is used for loading images in the JPEG format from files or IO streams.

See: PDF2.0 s7.4.8, ITU T.81 Annex B, ITU T.872

Constants

APP14_MARKER

Adobe uses the marker 0xEE (APPE or APP14) for its purposes. We need to use it for determinig whether we have a CMYK or YCCK image.

APP14_TRANSFORM_CMYK

Value of the 12th byte in an APP14 marker specifying that the image uses CMYK color encoding, with all four colors complemented.

EOI_MARKER

End-of-image marker

MAGIC_FILE_MARKER

The magic marker that tells us if the file/IO contains an image in JPEG format.

SOF_MARKERS

The various start-of-frame markers that tell us which kind of JPEG it is. The marker segment itself contains all the needed information needed for creating the PDF image object.

See: ITU T.81 B1.1.3

SOS_MARKER

Start-of-scan marker

Public Class Methods

handles?(filename) → true or false
handles?(io) → true or false

Returns true if the given file or IO stream can be handled, ie. if it contains an image in JPEG format.

load(document, filename) → image_obj
load(document, io) → image_obj

Creates a PDF image object from the JPEG file or IO stream.