> For the complete documentation index, see [llms.txt](https://docs.imagemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imagemash.io/image-transform/transform-options/output-format.md). Agents can also search and read this documentation through its [MCP server](https://docs.imagemash.io/~gitbook/mcp).

# Output Format

outputFormat - f - f\_\<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](https://docs.imagemash.io/image-transform/transform-options/filters/threshold-1.md) & [Background](https://docs.imagemash.io/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`.
