There are two entirely different jobs hiding behind "get the images out of this PDF", and picking the wrong one wastes an afternoon. One is extraction: recovering the original embedded image data — the photograph, the logo, the scan — exactly as it was stored. The other is rendering: producing a picture of how a page looks, which may combine dozens of image fragments with vector art and text. This guide covers both, and how to tell which you need.
Extraction versus rendering
Ask what you will do with the output.
- Reusing a photograph from a brochure in another document, or recovering a diagram at full resolution → extraction. You want the pixels the designer put in.
- Making a thumbnail, a preview, a slide, or an image of a page for OCR → rendering. You want a picture of the composed page, which is a different thing entirely and is covered in how to convert PDF to image.
The distinction matters most for scanned documents, where each page is a single full-page image and the two approaches converge, and for design-heavy files, where they diverge wildly.
Extraction with poppler's pdfimages
The reference tool is pdfimages, part of poppler. Start by listing what is in the file rather than dumping blindly:
pdfimages -list document.pdf
You get a table: page number, image type, width and height in pixels, colour space, bits per component, encoding, and — critically — the effective ppi at which the image is placed on the page. Read this before extracting. It tells you whether the "high-resolution photo" you are after is genuinely 3000 px wide or a 400 px thumbnail scaled up to fill a page.
Then extract:
pdfimages -all document.pdf out/img
-all writes each image in its native format where possible — JPEG stays JPEG, JBIG2 and CCITT become the appropriate format, everything else falls back to PNG. This is the flag you want. Older habits use -j (JPEG only) or the default PPM output; both are worse, because the default re-encodes everything into enormous uncompressed files and -j silently skips non-JPEG images.
Useful modifiers:
-f 3 -l 7to restrict to pages 3 through 7.-pto include the page number in each output filename, which makes a 400-image dump navigable.-pngto force PNG output when you want uniformity over fidelity.
pdfimages is covered alongside its siblings in poppler-utils introduction.
What extraction gives you, and what it does not
Extracted images come out as they were stored, which produces some surprises:
Images may be split into tiles. Some producers — particularly older Office exports and certain design tools — slice a single visual image into a grid of separate image objects. Extract, and you get 24 rectangular fragments instead of one photograph. Reassembly is possible but tedious; rendering the page region is usually faster.
Masks come out separately. A photo with a transparency mask is stored as two objects: the image and a soft mask. pdfimages -all writes both, and you get a picture plus a mysterious greyscale silhouette. Combining them requires an alpha composite in ImageMagick or similar.
CMYK images stay CMYK. Extract an image from a print-ready file and you may get a CMYK JPEG that looks wrong in a web browser and needs a conversion. See CMYK vs RGB in PDF.
No cropping or rotation is applied. The PDF may place only part of an image on the page, or rotate it 90°. Extraction gives you the stored original, uncropped and unrotated, which is often what you want and occasionally confusing.
Colour inversion happens with some CCITT-encoded scans, which come out as photographic negatives. -all handles most of these; the stragglers need a manual invert.
Extraction in GUI tools
If the command line is not available:
- Adobe Acrobat: Tools → Export PDF → Image, then tick Export all images. This extracts embedded images rather than rendering pages, and handles masks better than most.
- Acrobat, single image: right-click an image on the page → Copy Image, then paste. Fine for one, miserable for forty.
- macOS Preview: no true extraction. Copy-and-paste of a selection renders the region at screen resolution, which is a downgrade. For anything you care about, use another tool.
- LibreOffice Draw: opens a PDF, exposes images as separate objects you can right-click → Save. Rough, but it works and it is free.
- Browser-based extractors: several exist and work fine for casual use. As always, think about what you are uploading — are online PDF editors safe applies here as much as anywhere, and a brochure is a different risk from a medical scan.
Scripting extraction
For programmatic work, two well-trodden routes:
Python with PyMuPDF. page.get_images(full=True) returns the image XObjects referenced by a page; doc.extract_image(xref) hands back the raw bytes and the format string. It handles masks, gives you the colour space, and is fast enough for thousands of pages.
Python with pdfplumber or pypdf, if you are already using them for text. Less capable on masks and exotic encodings, fine for ordinary embedded JPEGs.
Both are worth wrapping with a size filter. Real documents are full of 16×16 bullet glyphs and 1×1 spacer images, and an unfiltered extraction of a hundred-page report gives you four hundred files, three hundred and eighty of which are junk. Discard anything under, say, 100 px in either dimension unless you have a reason not to.
When the page is the image
For a scanned document, each page is one big image and extraction is trivially the right approach — you get the scan back at its original resolution, without the re-compression that rendering would apply. This matters if you are feeding the result to OCR, because rendering at 150 dpi throws away detail the OCR engine wanted. See PDF OCR explained and scanning resolution and DPI for documents.
The one exception is a scan that has been through aggressive optimisation, where the page may have been split into a JBIG2 text layer plus a low-resolution JPEG background — the MRC segmentation used by many scanners. Extract that and you get two odd-looking layers rather than a page. Render instead.
Rights, briefly
Technical ease is not permission. An image embedded in a PDF is still someone's photograph, and stock licences in particular restrict extraction and reuse. Extracting your own company's diagram from an old brochure is fine; extracting a licensed photo from a competitor's report and using it is not. Nothing in the format enforces this, which is exactly why it is worth saying.
Summary
Use pdfimages -list to see what is actually in the file, then pdfimages -all -p to pull it out in native formats. Expect tiles, masks, and CMYK surprises in design-heavy documents. If what you actually want is a picture of the page rather than the source assets, you want rendering instead — a completely different operation with a completely different toolchain.