Image Resizing API

An API that allows client apps to minimise traffic by downsizing image assets according to UI needs

Image assets uploaded to the Studio Asset Library may be quite large. If the asset is downloaded by a client application "as is" it may unnecessarily over-consume network traffic and deteriorate user experience.

Image Resizing API allows the client application to constrain the dimensions of the asset downloaded in every specific case.

Invocation API

Originals for the image assets are available at the Studio’s CDN via the URLs structured like this:

https://<static_host>/assets/<uuid_prefix>/<uuid>/orig

To request a resized version of the original asset, the URL above needs to be modified as follows:

https://<static_host>/assets/<uuid_prefix>/<uuid>/resize[?<resizing_params>]

Note that the <static_host> and the asset UUID stay the same, but the orig keyword was replaced with resize. Optional query string parameters are:

  • width and height – target dimensions of the resized asset. They default to and limited by 2048, any value above 2048 will be trimmed to fit.

  • fit takes one of the following values: cover, contain, fill, inside (default), outside and defines how the image is resized and trimmed into the requested dimensions according to this diagram:

Examples

For an original asset URL:

https://cdn-dev.monterosa.cloud/assets/16/1659697f-e9ba-48b5-9858-252f1a54b70b/orig

This URL will return an asset that will be at most 1000 pixels wide, with the height calculated proportionally to the original asset dimensions:

https://cdn-dev.monterosa.cloud/assets/16/1659697f-e9ba-48b5-9858-252f1a54b70b/resize?width=1000

This URL will return an asset that is exactly 500x500 pixels, cropping the image if its proportions do not match the request:

https://cdn-dev.monterosa.cloud/assets/16/1659697f-e9ba-48b5-9858-252f1a54b70b/resize?width=500&height=500&fit=cover

Last updated

Was this helpful?