Image Resizing API
An API that allows client apps to minimise traffic by downsizing image assets according to UI needs
Last updated
An API that allows client apps to minimise traffic by downsizing image assets according to UI needs
Last updated
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.
Originals for the image assets are available at the Studio’s CDN via the URLs structured like this:
Assets created in older Studio versions may have different URL structures, including the original file name – please note that those are NOT supported and will fail if requested via this service, please filter them out in your client code if your Project still uses them!
To request a resized version of the original asset, the URL above needs to be modified as follows:
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:
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: