# File size, resolution and format

## **Which image formats are supported?** <a href="#q-what-are-the-max-resolution-and-size-of-the-image" id="q-what-are-the-max-resolution-and-size-of-the-image"></a>

For the input and result images, the Image Editing API supports three formats: PNG, JPEG and WEBP.

By default, the result image will be in PNG format.

To configure the format of the result image, set the argument `export.format` with one of the following values:

* `png` for PNG format (bigger file size, transparency is saved)
* `jpeg` or `jpg` for JPEG format (smaller file size, transparency is not saved)
* `webp` for WebP format (smaller file size, transparency is saved)

{% hint style="info" %}
Both JPEG and WebP export with a quality of 90
{% endhint %}

{% hint style="warning" %}
JPEG format does **not** support transparency.&#x20;

Asking the Image Editing API to export in JPEG while also setting a background color with transparency will result in an error.
{% endhint %}

If you want to give it a try, here's the code to export an image in JPEG format:

{% code overflow="wrap" %}

```bash
curl --request POST \
  --url https://image-api.photoroom.com/v2/edit \
  --header 'x-api-key: YOUR_API_KEY' \
  --form imageFile=@/path/to/your/image.jpg \
  --form background.color=FFFFFF \
  --form outputSize=1000x1000 \
  --form padding=0.1 \
  --form 'export.format=jpeg' \
  --output result.jpeg
```

{% endcode %}

<a href="https://try-api.photoroom.com/?background.color=FFFFFF&#x26;outputSize=1000x1000&#x26;padding=0.1&#x26;export.format=jpeg" class="button primary">Try it now!</a>

And here's the code to export an image in WebP format:

{% code overflow="wrap" %}

```bash
curl --request POST \
  --url https://image-api.photoroom.com/v2/edit \
  --header 'x-api-key: YOUR_API_KEY' \
  --form imageFile=@/path/to/your/image.jpg \
  --form background.color=FFFFFF \
  --form outputSize=1000x1000 \
  --form padding=0.1 \
  --form 'export.format=webp' \
  --output result.webp
```

{% endcode %}

<a href="https://try-api.photoroom.com/?background.color=FFFFFF&#x26;outputSize=1000x1000&#x26;padding=0.1&#x26;export.format=webp" class="button primary">Try it now!</a>

## **What are the max resolution and size of the image?** <a href="#q-what-are-the-max-resolution-and-size-of-the-image" id="q-what-are-the-max-resolution-and-size-of-the-image"></a>

We recommend limiting images to 25 megapixels for optimal performance.

* **Maximum File Size**: 30MB
* **Maximum Resolution**: 5,000 pixels on the widest side

Images with a larger resolution are supported (if they stay below 30MB), but will be resized down to 5,000 pixels on the widest side.

{% hint style="info" %}
Please note that large images will result in API calls taking a longer time to complete.

If you experience timeouts, we recommend that you try to increase the default timeout of your networking library.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.photoroom.com/image-editing-api-plus-plan/file-size-resolution-and-format.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
