Appearance
Image API
The Image API allows for Images to be converted and/or resized on demand. It will check to see if a Variant with the provided properties already exists and if not it will generate one and redirect the browser with a 301.
GET /services/images/v1/<uuid>
Resize an image and/or convert to a web friendly format.
| Property | Type | Description |
|---|---|---|
behavior | str | Determines the behavior to use when resizing an image: fill, fit, stretch. By default fit will be used to maintain the images aspect ratio. Note that behavior will only be applied when both a width and height are provided. If only width or height are provided, the image will be resized to dimension while maintaining the original aspect ratio. |
format | str | If provided, the image will be converted from the source format, to the format provided. See Formats below for valid choices. |
height | int | The height to resize the image to, between 0 and 20000. |
quality | int | The quality to set the image to (when using formats that support quality such as jpg), between 0 and 100. |
width | int | The width to resize the image to, between 0 and 20000. |
Constants
Resize Behavior
| Value | Description |
|---|---|
fill | Will resize the image filling the provided width and height. this may result if cropping if the images original aspect ratio is not maintained. |
fit | Will resize the images to fit within the provided width and height while maintaining the original aspect ratio. This may result in images that are smaller on one edge than the provided width and height. |
stretch | Will resize the image to fit exactly the provided dimensions. This is likely to result in distortion of the image unless the images aspect ratio is maintained. |
Formats
If provided, the image will be converted from the source forma, to the format provided. Valid options are:
| Value | Description |
|---|---|
gif | GIF (animated GIF's not available via Image API) |
jpg, jpg | JPEG |
jp2, j2k, jpeg2 | JPEG 2000 (Cannot convert images to JPEG 2000 because they are not web friendly) |
png | PNG |
tif, tiff | TIFF (Cannot convert images to TIFF because they are not web friendly) |
webp | WEBP |
Examples
Convert image from source format to JPEG at the original size:
GET /service/images/v1/00000000-0000-0000-0000-000000000000?format=jpgConvert image to JPEG and resize to fit bounding box while retaining aspect ratio:
GET /service/images/v1/00000000-0000-0000-0000-000000000000?format=jpg&behavior=fit&width=1000&height=1000