How to Convert Documents to Images
Convert a Word document, spreadsheet, presentation, or PDF into a separate PNG or JPEG for each page. Choose a workflow, resolution, and settings that preserve the result you need.
To convert a document into images, first export it as a PDF from the application that created it, then rasterize the PDF into one PNG or JPEG per page. This two-step workflow preserves page layout across word-processing documents, spreadsheets, presentations, and PDFs. For command-line conversion, ImageMagick can render PDF pages, but it requires Ghostscript to read PDF files.
Use PNG for text-heavy pages and diagrams when crisp edges matter. Choose JPEG when smaller files matter more than preserving every pixel, especially for photo-heavy pages. Set resolution for the intended screen or print use, and inspect page boundaries, fonts, and output dimensions afterward.
1. Choose the right workflow
| Starting point | Recommended route | Why |
|---|---|---|
| Word-processing file, spreadsheet, or presentation | Export to PDF in its authoring application, then rasterize the PDF | The application can preserve its page layout, fonts, and print settings before conversion. |
| Rasterize it directly with ImageMagick and Ghostscript | The pages already have a fixed layout. | |
| Need selected pages only | Select the page range during PDF export or specify pages during rasterization | It avoids producing images for pages you do not need. |
| Need editable or searchable content | Keep the source document or PDF as well as the images | Rasterized images do not retain selectable document text or PDF structure. |
There is no single set of menu steps for every document application and operating system. The exact route depends on the file type and software. The commands below use LibreOffice for PDF export and ImageMagick for rendering. Consult the current help for your authoring application if you use different software.
2. Export a document to PDF
Open the document in LibreOffice and export it as PDF. In the PDF export options, choose all pages, a range of pages, or a selection as appropriate. You can also choose lossless or JPEG compression and set an image resolution. These are PDF export settings; they control images embedded in the PDF, while the final rasterization resolution is set in the next step. See LibreOffice PDF Export General.
- Review the document’s page layout before export, especially page breaks, spreadsheet print areas, slide dimensions, margins, and fonts.
- Export to a PDF file, choosing all pages or the required page range.
- If the document contains images, choose suitable PDF image compression settings. Lossless compression preserves image pixels; JPEG compression can reduce size but may introduce artifacts.
- Keep the PDF as an intermediate or archival copy if you may need to export the pages again.
For screen viewing, the LibreOffice 25.2 guide says resolutions at or below 100 DPI may suffice. For print, it suggests at least 300 or 600 DPI depending on printer capability. These are guide recommendations, not universal requirements; higher resolution also increases pixel dimensions and file size. See The Document Foundation’s Getting Started Guide 25.2.
3. Install and use ImageMagick to render PDF pages
Install ImageMagick and Ghostscript for your operating system. ImageMagick documents PDF as an input format and notes that Ghostscript is required to read it. The commands below use magick, the ImageMagick command-line interface. Check your installed version’s help if your platform uses a different command name.
Render every page as PNG
magick -density 150 input.pdf page-%03d.png
This produces numbered files such as page-000.png, page-001.png, and so on. The density setting controls the rendering resolution. Adjust it to your output needs; do not assume that one value is right for every page size or destination.
Render every page as JPEG
magick -density 150 input.pdf -quality 85 page-%03d.jpg
JPEG is lossy. The quality value is a setting to adjust based on the acceptable tradeoff between file size and visible artifacts. For a text-heavy page, inspect thin lines and small text carefully. Use PNG if preserving crisp text edges is more important than file size.
Render a selected page or range
ImageMagick supports selecting pages with a PDF page index in the input filename. For example, to render the first page:
magick -density 150 'input.pdf[0]' first-page.png
Page indices in this syntax are zero-based, so [0] refers to the first page. Check the result and your ImageMagick version’s command-line documentation when selecting ranges, because shell quoting and supported syntax can vary. The export-to-PDF stage can also limit the pages before rasterization.
Adjust the page boundary
ImageMagick uses the PDF MediaBox by default. A PDF’s CropBox or TrimBox may define a smaller intended page boundary. If the output includes unwanted margins or marks, select the appropriate PDF box using ImageMagick’s documented options and inspect the rendered edges. The available controls are described in ImageMagick’s format reference and command-line options.
4. Select format, resolution, and page bounds
| Choice | Use it when | Tradeoff |
|---|---|---|
| PNG | Text, line art, diagrams, or pixel preservation matter | Files can be larger, particularly at high resolution. |
| JPEG | Photographs dominate and smaller files are useful | Compression loses pixel information and can create visible artifacts. |
| Lower density | Images are mainly for screen viewing or previews | Small text and fine detail may be harder to read. |
| Higher density | Print output or fine detail requires more pixels | More pixels mean larger images and greater storage and processing needs. |
| MediaBox | The full PDF page boundary is intended | May include areas beyond the CropBox or TrimBox. |
| CropBox or TrimBox | The PDF defines a smaller visible or trimmed page area | Incorrect box selection can cut off wanted content. |
DPI describes resolution relative to physical size; output pixel dimensions depend on both the PDF page dimensions and rendering density. ImageMagick notes that only some formats, including JPEG, PNG, and TIFF, can store image resolution metadata. Its -resample option changes pixel dimensions to preserve rendered physical size at a specified resolution. See ImageMagick’s command-line options.
5. Check the output
Before distributing or processing the images, verify the conversion against the source:
- Confirm that the number of images matches the pages you intended to export.
- Check that the filenames sort in page order. Zero-padded numbering, such as
page-%03d, helps keep lexical order consistent. - Inspect page edges and margins for clipping or extra whitespace; confirm that the chosen PDF page box matches your goal.
- Zoom in on small text, thin rules, charts, and logos at the target display size.
- Check font substitution, table breaks, spreadsheet print areas, slide scaling, image transparency, and any content close to page edges.
- Open the images in the software that will consume them if color handling or metadata matters.
6. Automate a folder of PDFs
For a simple batch on a shell with ImageMagick and Ghostscript installed, run the conversion once per PDF. This Bash example creates a separate output directory for each input file and names pages in sequence:
#!/usr/bin/env bash
set -euo pipefail
mkdir -p converted
for pdf in ./*.pdf; do
[ -e "$pdf" ] || continue
name="$(basename "$pdf" .pdf)"
mkdir -p "converted/$name"
magick -density 150 "$pdf" "converted/$name/page-%03d.png"
done
Run it from the directory containing the PDFs. For very large documents or batches, process files in manageable groups and ensure sufficient temporary disk space: high-resolution pages can consume much more storage than the PDFs. Choose a density and output format appropriate to the downstream use, and retain source PDFs if you need to reproduce the images later.
7. Troubleshoot common conversion problems
| Symptom | Likely cause | What to do |
|---|---|---|
| ImageMagick says it cannot read or convert PDF | Ghostscript is missing, unavailable, or not detected | Install Ghostscript for your platform, make sure it is available to ImageMagick, and retry. PDF reading requires it. |
| Images are too small or text looks rough | Rendering density is too low for the intended display or print size | Increase -density and render again; expect larger pixel dimensions and files. |
| Output files are unexpectedly large | High density, many pages, or lossless output | Lower the density if the destination permits, or use JPEG where lossy artifacts are acceptable. Reduce the exported page range if not every page is needed. |
| Page edges include unwanted marks or margins | The default MediaBox differs from the intended CropBox or TrimBox | Choose the appropriate PDF box with ImageMagick’s documented options and inspect the result. |
| Content is clipped | The selected page box is too small, or the source layout extends beyond the page | Try the intended larger box and inspect the document’s original page layout and export settings. |
| Only one image is produced for a multi-page PDF | The command or output naming pattern is not expanding pages as expected | Use a numbered output pattern such as page-%03d.png and check the command output and installed ImageMagick documentation. |
| Images look different from the document | PDF export changed layout, substituted fonts, compressed embedded images, or used different page settings | Review the PDF before rasterizing; correct the document or export options, then render again. |
| JPEG text has halos or blocky edges | Lossy compression is affecting fine detail | Raise JPEG quality or use PNG for text-heavy pages and line art. |
8. Browser screenshots are a different task
Document-to-image conversion renders fixed pages from a document or PDF. Capturing a live website is a different job: a browser must load the page, and the result depends on viewport, page state, and site behavior. For website screenshots, ScreenshotNeo is a screenshot API and MCP server for developers. Its API returns PNG, JPEG, WebP, or PDF from one GET request. The call below captures a web page; it does not convert a local office document.
Or skip the browser setup
For a website screenshot, use the API call below. See the ScreenshotNeo API documentation for configuration and response details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
- Cookie banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing. Response headers report the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - Every feature is on every plan. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Yearly billing gives two months free.
Sign up for 1,000 free screenshots a month, with no card required.
9. Frequently asked questions
Can I turn a multi-page document into one image?
Yes. The commands above create a separate image per page. If you need a single tall image instead, that is a separate assembly step and may produce an unwieldy file; first render and inspect the pages individually.
Will the resulting images keep searchable text?
No. Raster images contain pixels rather than selectable document text. Keep the source file or PDF when search, accessibility structure, or later editing matters.
Can I convert directly from Word, Calc, or Impress without a PDF?
The general workflow here uses the authoring application to export PDF first, then renders that stable page layout. Exact direct-export features vary by application and are outside the documented steps in this guide.
Which image format should I choose?
Choose PNG for crisp text and line art; choose JPEG when smaller files matter and some compression artifacts are acceptable. Inspect the result at its actual destination size.


