# Media format

The media module delivering assets provides methods to perform various manipulation functions on a given image or file based on querystring parameters.

### Supported query parameters

<table><thead><tr><th width="138.99993896484375" valign="top">Parameter</th><th>Description</th><th data-hidden>Usage</th></tr></thead><tbody><tr><td valign="top">width</td><td><p>For mode Pad passing just one dimension will automatically preserve the aspect ratio of the original image.</p><p>For mode BoxPad when upscaling an image the image pixels themselves are not resized, rather the image is padded to fit the given dimensions. If downscaling it will behave the same as Pad. </p><pre class="language-xml"><code class="lang-xml">?width=100
</code></pre></td><td></td></tr><tr><td valign="top">height</td><td><p>For mode Pad passing just one dimension will automatically preserve the aspect ratio of the original image.</p><p>For mode BoxPad when upscaling an image the image pixels themselves are not resized, rather the image is padded to fit the given dimensions. If downscaling it will behave the same as Pad. </p><pre><code>?height=10
</code></pre></td><td></td></tr><tr><td valign="top">format</td><td><p>Converts current asset to a new image format.</p><p></p><p>Supported image formats: jpg, png, webp, gif</p><p>Supported file to image formats: pdf, psd, eps </p><pre><code><strong>?format=webp
</strong></code></pre></td><td></td></tr><tr><td valign="top">mode</td><td><p>The following modes are supported:</p><ul><li>Pad<br>Passing a single dimension will automatically preserve the aspect ratio of the original image. If the requested aspect ratio is different then the image will be padded to fit. Widths and heights can optionally also be passed as a ratio<br>This is default.</li><li>BoxPad<br>When upscaling an image the image pixels themselves are not resized, rather the image is padded to fit the given dimensions. When downscaling the image is resized using the rules defined by Pad</li><li>Crop<br>Resizes the image to the given dimensions. If the set dimensions do not match the aspect ratio of the original image then the output is cropped to match the new aspect ratio.</li></ul><pre><code>&#x26;mode=boxpad
</code></pre></td><td></td></tr><tr><td valign="top">quality</td><td><p>Alters the output quality of the current image. This method will only effect the </p><p>output quality of images that allow lossy processing. </p><pre class="language-html"><code class="lang-html">&#x26;quality=90
</code></pre></td><td></td></tr><tr><td valign="top">anchor</td><td><p>Anchor positions supported:</p><ul><li>center</li><li>top</li><li>right</li><li>bottom</li><li>left</li><li>topleft</li><li>topright</li><li>bottomleft</li><li>bottomright</li></ul><p>Center is default.</p><pre class="language-html"><code class="lang-html">&#x26;mode=crop&#x26;anchor=top
</code></pre></td><td></td></tr><tr><td valign="top">bgcolor</td><td><p>When padding applied and or image includes transparency, it is possible to set the color of the padding/baggrund. </p><pre><code>&#x26;bgcolor=ffffff
</code></pre></td><td></td></tr></tbody></table>

### Examples

<figure><img src="/files/b9LEsTlEEqTocKufmj9l" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/rmGBt0Lh0uGTpJUjTcJ0" alt=""><figcaption><p>?width=250</p></figcaption></figure>

<figure><img src="/files/Ku2743oE4AtFiwSUTFw7" alt=""><figcaption><p>?width=550&#x26;height=550&#x26;mode=crop&#x26;anchor=left</p></figcaption></figure>

<figure><img src="/files/BMbH2SioYxximmBPNulk" alt="" width="563"><figcaption><p>?width=1100&#x26;height=1100&#x26;mode=boxpad&#x26;bgcolor=lightblue</p></figcaption></figure>


---

# 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.struct.com/pim3/integration/media-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.
