# PdfImageFormat

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / PdfImageFormat

# Enumeration: PdfImageFormat

Defines formats that can be used to encode images in a PDF.

## Enumeration Members

### Auto

> **Auto**: `0`

Select the optimal format automatically based on the particular image and document options (recommended).
The following rules are used:
-) If the image is a JPEG or a JPEG2000, the image data is written as is without any additional processing.
-) If the image contains transparency, "Raw" is used.
-) If [PdfDocument#compressionLevel](../classes/PdfDocument#compressionlevel) is "NoCompression", "Jpeg" is used.
-) Otherwise the format is selected that provides the minimal data size for the image.

***

### Jpeg

> **Jpeg**: `1`

Use JPEG to encode images.

Note that when using this format, any transparency that may be present
in an original image will be lost, as JPEG does not support transparency.

***

### Raw

> **Raw**: `2`

Do not encode image data.

When using this format, the [PdfDocument#compressionLevel](../classes/PdfDocument#compressionlevel) affects
the final PDF size, and in combination with "Optimal""
it may produce better compression than JPEG for certain types of images
(e.g. screenshots of mostly text screens).
