Skip to content

happypdf / extractImageBytes

Function: extractImageBytes()

ts
function extractImageBytes(stream): ExtractedImageBytes | undefined;

Defined in: src/api/extraction/imageBytes.ts:25

Convert an Image XObject stream into usable image file bytes.

  • DCTDecode → JPEG bytes as stored
  • DeviceRGB / DeviceGray 8-bit (typically Flate) → PNG Returns undefined for unsupported color spaces / filters.

Parameters

ParameterType
streamPDFStream

Returns

ExtractedImageBytes | undefined

MIT Licensed. A fork of pdf-lib.