Qu

pdf.extract_image

Builtin index · File I/O

pdf.extract_image(src, page, index)

Input: src, page, index · Output: no output

What it is

Decodes image number index (from pdf.images) of page page to an Image. Decoded: DCTDecode (JPEG, grey or RGB), and raw or FlateDecode/LZWDecode/ASCII-filtered samples (with PNG or TIFF predictors) in DeviceGray, DeviceRGB, CalGray, CalRGB, 1- or 3-component ICCBased and Indexed colour spaces, at 1, 2, 4, 8 or 16 bits (16 keeps the high byte), and image masks as black on white. An image using JBIG2Decode, CCITTFaxDecode or JPXDecode is an error naming that filter, as are CMYK, Separation, Lab and DeviceN images and a JPEG chained after another filter. A soft mask (/SMask, transparency) is not applied: you get the colour channels only. Different from pdf.render, which draws the whole page and needs PDFium: this returns the stored picture at its own resolution.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
pdf.extract_image(src, page, index)
src —not documented yet
page number or ImageDecodes image number index (from pdf.images) of page page to an Image.
index number or ImageDecodes image number index (from pdf.images) of page page to an Image.
not documented yetDecoded: DCTDecode (JPEG, grey or RGB), and raw or FlateDecode/LZWDecode/ASCII-filtered samples (with PNG or TIFF predictors) in DeviceGray, DeviceRGB, CalGray, CalRGB, 1- or 3-component ICCBased and Indexed colour spaces, at 1, 2, 4, 8 or 16 bits (16 keeps the high byte), and image masks as black on white. An image using JBIG2Decode, CCITTFaxDecode or JPXDecode is an error naming that filter, as are CMYK, Separation, Lab and DeviceN images and a JPEG chained after another filter. A soft mask (/SMask, transparency) is not applied: you get the colour channels only.

Examples

No documentation example calls this form yet. The File I/O chapter is where one belongs.

How it works

pdf.extract_image(src, page, index) -> Image.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.