# Convert images to PDF

Turn one image, several images, or a folder of images into a PDF with one page per image, from SumatraPDF or from the command line.

**Available in [pre-release 3.7](https://www.sumatrapdfreader.org/prerelease)**

**Open the image (or folder) and use File → Convert to PDF…** At a glance:

- **In SumatraPDF:** **Convert to PDF…** (`CmdConvertToPDF`) — the image, or every image in the folder, to one PDF.
- **Current page only:** **Convert page to PDF** (`CmdConvertImageToPdf`), via the image editor.
- **Command line:** `sumatrapdf-tool convert -O compress -o out.pdf a.png b.jpg`

To convert a comic book archive (`.cbz`, `.cbr`, ...), see [Convert comics to PDF](Convert-comics-to-PDF.md).

## Convert in SumatraPDF

1. Open an image, or a folder of images (see [Comics and manga](Comics-and-manga.md#open-a-comic-or-image-folder)).
2. Start **Convert to PDF…** in any of these ways:
   - **File → Convert to PDF…**
   - Right-click the document → **Document → Convert to PDF…**
   - Right-click an image → **Convert to PDF...**
   - `Ctrl + K`, `Convert To PDF` in [Command Palette](Command-Palette.md)
3. A dialog shows the source path and a suggested destination:
   - Default path is the same location and base name with a `.pdf` extension.
   - If that file already exists, the name is made unique (e.g. `photo.1.pdf`).
   - Edit the path in the text field, or use **…** to browse.
4. Click **Convert to PDF**. On success the new PDF is written and opened in SumatraPDF. On failure you get a short error dialog.

Press **Esc** or **Cancel** to close the dialog without converting.

Works for PNG, JPEG, WebP, JPEG XL, HEIC, AVIF, TIFF, GIF, and [other image types](Supported-document-formats.md). Animated GIFs, multi-page TIFFs and ICO files get one page per frame.

### Convert only the current page

**Convert page to PDF** (`CmdConvertImageToPdf`, on the image context menu) converts only the current page, through the image editor and a save dialog. For a single image **Convert to PDF…** gives the same one-page PDF without opening the image editor.

### How images are stored in the PDF

SumatraPDF embeds the original image bytes when PDF can use them directly:

| Format                                          | Behavior                                                                        |
| ----------------------------------------------- | ------------------------------------------------------------------------------- |
| **JPEG**, **PNG**                               | Embedded as-is (usually the most compact)                                       |
| **Animated GIF, multi-page TIFF, ICO**          | Each frame is rendered as its own page                                          |
| **WebP, JPEG XL, HEIC, AVIF, TGA**, and similar | Decoded, encoded as PNG, then losslessly recompressed (zopfli) before embedding |
| If encode/embed fails                           | Page is **rendered** into the PDF as a last resort                              |
| If every path fails for a page                  | That page is **skipped** (conversion continues with the rest)                   |

There is no quality / DPI setting: JPEG and PNG keep their original data, other formats go through a lossless PNG path. The PDF's producer metadata is set to the current SumatraPDF version (e.g. `SumatraPDF 3.7`).

## Convert from the command line

Use `sumatrapdf-tool.exe convert`, or [SumatraPDF.exe convert](Tools.md) with the same arguments.

One image:

```
sumatrapdf-tool convert -O compress -o photo.pdf photo.png
```

Several images, one page each, in the order given:

```
sumatrapdf-tool convert -O compress -o album.pdf 01.png 02.jpg 03.png
```

Every image in a folder, in file name order:

```
sumatrapdf-tool convert -O compress -o album.pdf C:\Photos\Trip
```

- `-O compress` compresses the image data. Without it PNG and other non-JPEG images are stored uncompressed: a 20 kB PNG screenshot becomes a 790 kB PDF instead of 25 kB. JPEG images are always embedded as-is.
- Reads PNG, JPEG, WebP, BMP, GIF and TIFF. For HEIC, AVIF and JPEG XL, use **Convert to PDF…** in SumatraPDF.

More options: [sumatrapdf-tool convert](Tool-convert.md).

## Tips

- Use JPEG or PNG sources for the smallest PDF; they are embedded without re-encoding.
- Name files `01.png`, `02.png`, ... so a folder converts in the right order.
- Use [Compress a PDF](Tool-x-compress-pdf.md) for documents that are already PDF.

## See also

- [Convert comics to PDF](Convert-comics-to-PDF.md)
- [Convert PDF to images](Convert-PDF-to-images.md) — the reverse direction
- [sumatrapdf-tool convert](Tool-convert.md)
- [Supported document formats](Supported-document-formats.md)
- [All cmd-line tools](Tools.md)
