# Output Format

<table><thead><tr><th width="165.33333333333331">Value</th><th width="91">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>output format</strong></td><td>string</td><td><p><em>Default Value: <strong>webp</strong></em></p><p>Value can be;</p><ul><li>webp, png, jpg, jpeg, avif, gif</li><li><a href="#sjpg">sjpg</a> (smart jpg-png conversation)</li></ul><p>Eg. f_webp, f_png, ...</p></td></tr></tbody></table>

Sets the output format of the image.

<figure><img src="https://demo.imagemash.io/w_400/green_view.png" alt=""><figcaption><p><a href="https://demo.imagemash.io/w_400/green_view.png">https://demo.imagemash.io/w_400/green_view.png</a></p></figcaption></figure>

<figure><img src="https://demo.imagemash.io/w_400,f_png/green_view.png" alt=""><figcaption><p><a href="https://demo.imagemash.io/w_400,f_png/green_view.png">https://demo.imagemash.io/w_400,f_png/green_view.png</a></p></figcaption></figure>

{% hint style="warning" %}
You may lose transparency when getting certain types of image formats. Transparent pixels become black when transparency is lost.
{% endhint %}

<figure><img src="https://demo.imagemash.io/w_400,f_jpg/green_view.png" alt=""><figcaption><p><a href="https://demo.imagemash.io/w_400,f_jpg/green_view.png">https://demo.imagemash.io/w_400,f_jpg/green_view.png</a></p></figcaption></figure>

{% hint style="info" %}
Use [Flatten](/image-transform/transform-options/filters/threshold-1.md) & [Background](/image-transform/transform-options/background.md) functions before changing the format to adjust the background color.\
Also consider that you may not need to change the format to jpg, since the alpha layer is gone by applying Flatten function.
{% endhint %}

<figure><img src="https://demo.imagemash.io/w_400,flatten,bg_skyblue,f_jpg/green_view.png" alt=""><figcaption><p><a href="https://demo.imagemash.io/w_400,flatten,bg_skyblue,f_jpg/green_view.png">https://demo.imagemash.io/w_400,flatten,bg_skyblue,f_jpg/green_view.png</a></p></figcaption></figure>

### sjpg

Smart jpg/png transformation. Detects transparency in the image. If transparency is found in the image, the output format will be set to `png`. Otherwise, the output format will be set to `jpg`.


---

# 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.imagemash.io/image-transform/transform-options/output-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.
