The tidy picture of a PDF is that each image is an object with a number and the page just points at it. A second kind has no number at all: the picture is written straight into the page's content stream, between three keywords: BI, ID and EI. The trap shows up when a script lists 1 image on a test page that has 3. Below is one real content stream, line by line. All numbers come from one Apple-silicon Mac, each method run once, on four small PDFs written by hand (T1 to T4); the photo in them is a crop of Bonnie Moreland's Lake Mountain Landscape, Wikimedia Commons, CC0.

Two ways to store one image

The common way is an XObject. The image lives in its own object with an object number, and the content stream only says /Im1 Do, roughly "draw the thing named Im1". A tool that walks the page's resource dictionary finds it.

The other way is an inline image. The content stream itself carries the dictionary and the pixel bytes: BI opens it, ID marks where the data starts, EI closes it. There is no object number and nothing in the resource dictionary, so a tool that only reads /XObject never sees it.

Content stream excerpt with BI, ID and EI highlighted, plus a table of abbreviated inline keys

What to look at in this figure: the yellow BI, ID and EI wrap each inline picture on the left, the green Do at the bottom is the only trace of an XObject, and the key table on the right maps /W and /CS to their full names. It is an excerpt of a hand-built test page.

The stream, printed

The test page, called T2 here, has one XObject picture and six inline ones. The snippet prints its content stream and swaps long binary data for a byte count.

# print page 1's content stream of t2.pdf; long binary data is shown only as a byte count import re, fitz s = fitz.open('t2.pdf')[0].read_contents() s = re.sub(rb'ID (.*?)\nEI', lambda m: b'ID <%d bytes>\nEI' % len(m.group(1)) if not m.group(1).rstrip().endswith(b'>') else b'ID ' + m.group(1)[:24] + b'...>\nEI', s, flags=re.S) print(s.decode('latin-1')) 

The real output is 36 lines. The table below lists every one of them in order, copied as printed, with a short note beside each.

# Printed line What it is
1 BT /F1 11 Tf 20 280 Td (T2: inline images with filters / colour spaces) Tj ET text label
2 q 150 0 0 90 20 160 cm /Im1 Do Q the XObject: a 150×90 box at (20, 160), then draw Im1
3 BT /F1 9 Tf 20 148 Td (XObject /Im1 (Flate 200x120)) Tj ET text label
4 q 40 0 0 40 200 190 cm save state, place a 40×40 box at (200, 190)
5 BI /W 32 /H 32 /BPC 8 /CS /RGB /F /DCT inline JPEG: dictionary
6 ID <903 bytes> data, shown as a byte count
7 EI end of the inline image
8 Q restore state
9 BT /F1 9 Tf 200 180 Td (/F /DCT) Tj ET text label
10 q 40 0 0 40 260 190 cm place the next box
11 BI /W 16 /H 16 /BPC 8 /CS /RGB /F /AHx inline image, data written as hex text
12 ID FFFFFFFFFFFFFFFFFFFFFFFF...> data, cut at 24 characters
13 EI end
14 Q restore state
15 BT /F1 9 Tf 260 180 Td (/F /AHx) Tj ET text label
16 q 40 0 0 40 320 190 cm place the next box
17 BI /W 16 /H 16 /BPC 8 /CS /RGB /F [/AHx /Fl] two filters stacked
18 ID 78dafbff7f6080dc82009214...> data, cut at 24 characters
19 EI end
20 Q restore state
21 BT /F1 9 Tf 315 180 Td ([/AHx /Fl]) Tj ET text label
22 q 40 0 0 40 200 110 cm place the next box
23 BI /W 16 /H 16 /BPC 8 /CS [/I /RGB 2 <FF0000 00A050 0050FF>] palette image
24 ID <256 bytes> data, shown as a byte count
25 EI end
26 Q restore state
27 BT /F1 9 Tf 200 100 Td (/CS [/I ...]) Tj ET text label
28 0.8 0.1 0.1 rg set the fill colour to a dark red
29 q 40 0 0 40 260 110 cm place the next box
30 BI /IM true /W 16 /H 16 /BPC 1 1-bit inline image
31 ID <32 bytes> data, shown as a byte count
32 EI end
33 Q restore state
34 BT /F1 9 Tf 260 100 Td (/IM true) Tj ET text label
35 q 40 0 0 40 320 110 cm /Fm1 Do Q a Form XObject, which holds one more inline image
36 BT /F1 9 Tf 315 100 Td (Form + inline) Tj ET text label

Reading it line by line

The XObject line only says where to draw. Each inline block is the opposite: BI opens a dictionary of abbreviated keys, ID is where the data starts, and EI ends it. In the first block, /F /DCT means a JPEG, and the script replaced its 903 bytes with a count.

The hex block shows how the filter changes the data line. /AHx means hexadecimal text, so that line is readable, and the script cut it at 24 characters. [/AHx /Fl] decodes hex first and then Flate; the data starting with 78da fits that, though this is a reading of the output and the script did not check it.

In the palette block, /I is not Interpolate. As a colour-space value it means Indexed, so a three-colour palette follows and the data is one byte per pixel: 16×16 = 256, matching the count. As a key, /I true means Interpolate. The 1-bit block is 16×16 bits = 32 bytes, again arithmetic on the printed numbers. The Form line hides one more inline image, which only shows up when you open the Form.

What goes missing and what does not

On a three-image test page (one XObject, two inline), PyMuPDF 1.26.5 page.get_images() listed 1 image. That method reads the XObject resources, so the two inline ones are invisible to it. pdfimages -list from poppler printed all 3 and tagged the inline ones [inline]. PyMuPDF's get_image_info(xrefs=True) also found all 3, with xref 0 on the inline ones. pypdf 6.10 listed the page's inline images under keys such as ~0~, but on T2 it listed 5 of them twice and missed the one inside the Form. One run on one hand-made file, not a verdict on pypdf.

The 903-byte JPEG in T2 is a useful check. The bytes between ID and EI are a normal JPEG, and the files exported by pdfimages, pypdf and ImgIng, a browser-based PDF image extractor at https://imging.ai/ , all came out byte-for-byte identical to it. On a two-page PDF repeating 8 small icons, ImgIng gave 9 results in total, merging repeats into one entry with both page numbers. Only ordinary inline images were checked this way.

How common are they

On this one machine they were rare. Across about 887 PDFs on one work computer, pdfimages counted 0 inline images. Counting by "xref equals 0" in PyMuPDF reported 52 files and 1,691 images, and the spot checks showed false alarms (the cause was not pinned down). The usual claim that inline images show up in icons, formulas and scanner-cut tiles stays a common saying here: the sample had no TeX output, no old scanners and no JBIG2 files.

Finding them by hand

If a list of a page's images looks too short, check whether the tool reads only the XObject resources. Search the content stream for BI carefully, because a plain text search over-counts: on a test page with 16 inline icons it found 18, and the extra two were the letters BI inside a text string that explains the keywords.