> For the complete documentation index, see [llms.txt](https://docs.spectrumcustomizer.com/integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spectrumcustomizer.com/integration/api/image-querystring-api/image-transforms.md).

# Image Transforms

## QueryString API

* `width` constrains the image width. `w` is an alias for `width`
* `height` constrains the image height. `h` is an alias for `height`
* `dpr` is a multiplier for `width`/`height` to make responsive image usage easier.
* `mode` determines how to handle aspect ratio differences.
  * `stretch` distorts the image to be exactly the given dimensions, if `scale=both`. If `scale=down` (the default), the image is only scaled if `width` and `height` are smaller than the image.
  * `pad` scales the image to fit within `width` and `height`, then pads 2 edges (`bgcolor`) to make it.
  * `crop` scales the image to fit above `width` and `height`, then minimally crops to meet aspect ratio.
  * `max` scales the image to fit within `width` and `height`
* `scale` controls whether images are upsampled or not.
  * `down` - Never upscale an image - return at original size instead
  * `both` - Downscale or upscale to meet size requirements. Image enlargement causes blurriness and should be avoided.
  * `canvas` - Add padding instead of upscaling to meet size requirements.
  * `up` - Never downscale, only upscale to meet requirements. Rarely used.
* `anchor` determines how the image is aligned when you use `mode=crop`, `mode=pad` or `scale=canvas`. The default is `middlecenter`
  * values are `topleft`, `topcenter`, `topright`, `middleleft`, `middlecenter`, `middleright`, `bottomleft`, `bottomcenter`, and `bottomright`.
* `sflip` flips the source image in the `x`, `y`, or `xy` dimensions.
* `flip` flips the result image in the `x`, `y`, or `xy` dimensions.
* `srotate` rotates the source image `90`, `180`, or `270` degrees.
* `rotate` rotates the result image `90`, `180`, or `270` degrees.
* `crop=x1,y1,x2,y2` crops the source image to the given coordinates. If x2 or y2 are negative, they are relative to the bottom-right corner of the image. `crop=10,10,-10,-10` removes 10 pixels from the edge of the image.
* `cropxunits=100&cropyunits=100` makes the `crop` coordinates percentages of the image instead of pixels.
* `trim.threshold=80` specifies a threshold to use for trimming whitespace.
* `trim.percentpadding=0.5` specifies percentage of padding to restore after trimming.
* `bgcolor` must be in the form RGB, RGBA, RRGGBBAA, RRGGBB, or be a named color. `bgcolor` determines the color of padding added with `mode=pad` or `scale=canvas`.
* `ignoreicc=true` causes the source image's color profile to be ignored and treated as sRGB.
* `ignore_icc_errors=true` causes color profile errors to be ignored rather than causing the operation to fail.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.spectrumcustomizer.com/integration/api/image-querystring-api/image-transforms.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.
