> ## Documentation Index
> Fetch the complete documentation index at: https://docs.screenshotly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Formats and quality

> Choose between PNG, JPEG, WebP, and PDF output formats, and control image quality settings.

Screenshotly supports multiple output formats. Choose the one that best fits your use case.

## Supported formats

| Format   | Best for                                 | Transparency | Compression |
| -------- | ---------------------------------------- | ------------ | ----------- |
| **PNG**  | UI screenshots, pixel-perfect captures   | Yes          | Lossless    |
| **JPEG** | Photos, large pages, smaller file sizes  | No           | Lossy       |
| **WebP** | Web delivery, best size-to-quality ratio | Yes          | Both        |
| **PDF**  | Printable documents                      | N/A          | N/A         |

## Setting the format

<CodeGroup>
  ```javascript JavaScript SDK theme={null}
  const screenshot = await client.capture({
    url: 'https://example.com',
    format: 'webp'
  });
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.screenshotly.dev/v1/capture \
    -H "X-API-Key: $SCREENSHOTLY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://example.com",
      "options": { "format": "webp" }
    }' \
    --output screenshot.webp
  ```
</CodeGroup>

The default format is `png`.

## Quality settings

For JPEG, WebP, and PDF formats, use the `image_quality` parameter to control compression. The value is an integer between 0 and 100 (default: 80):

```javascript theme={null}
const screenshot = await client.capture({
  url: 'https://example.com',
  format: 'jpeg',
  image_quality: 85
});
```

| Quality range | File size | Visual quality           |
| ------------- | --------- | ------------------------ |
| 90–100        | Large     | Highest fidelity         |
| 70–89         | Medium    | Good for most uses       |
| 50–69         | Small     | Noticeable artifacts     |
| Below 50      | Smallest  | Significant quality loss |

<Note>
  The `image_quality` parameter has no effect on PNG format since PNG uses lossless compression.
</Note>

## Transparent backgrounds

For PNG and WebP formats, use `omit_background` to remove the default white background:

```bash theme={null}
curl -X POST https://api.screenshotly.dev/v1/capture \
  -H "X-API-Key: $SCREENSHOTLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "options": {
      "format": "png",
      "omit_background": true
    }
  }' \
  --output screenshot.png
```

## PDF output

Screenshotly supports PDF output by setting `format` to `pdf`:

```bash theme={null}
curl -X POST https://api.screenshotly.dev/v1/capture \
  -H "X-API-Key: $SCREENSHOTLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "options": { "format": "pdf" }
  }' \
  --output page.pdf
```

## Choosing a format

* Use **PNG** when you need transparency or pixel-perfect accuracy
* Use **JPEG** at quality 75–85 for the best balance of size and quality
* Use **WebP** for web delivery where browser support is available
* Use **PDF** when you need a printable document format
