Cloudimage - Documentation

Accounts created before Nov. 1st, 2021

Accounts created before November 1, 2021 have to include /v7/ in the path, like shown below.

//token.cloudimg.io/v7/original_image_url?operations&filters

Accounts created on or after November 1, 2021 do not require /v7/ and documentation have been updated accordingly.
To verify the type of configuration on your Cloudimage account, log in to your Cloudimage admin panel and look at the syntax provided on the Welcome page.

[NOTE] If you are an existing Cloudimage customer and wish to be able to remove the v7 from your URL syntax, please contact our support.

Fit

Resizes the image to fit into a specified width and height box, adds padding (image or solid colour) to keep proportions, and delivers the resulting image via CDN.

func=fit

The padding can be customised using the following additional operations:

functionnamedescription
gravitygravity=X
X = [north | south][east | west]
sets the position of the image in the fit box
solid backgroundbg_colour=X | bg_color=Xdefines a background colour either with a hex code or colour name
bg_colour=auto | bg_color=autoextracts the most prominent colour from the image and uses it as a background colour
blurred backgroundbg_img_fit=1sets blurred image background
bg_blur=Xapplies Gaussian blur to the background image
bg_opacity=X
X = 0..1
specifies background image opacity
bg_colourise=X | bg_colorize=Xdefines a colour to tint the background image

Solid colour padding

/sample.li/car1.jpg?w=400&h=320&
func=fit&bg_color=black

For details, please see the solid background section.

Gravity

The gravity=X operation sets the position of the image when padding is added. Possible values are:

northwestnorthnortheast
westcentre | centereast
southwestsouthsoutheast

If not explicitly set, the default gravity is centre.

For example, by setting gravity to south, the image is positioned at the bottom and the padding is added at the top.

Enabling image upscaling

By default, the fit operation does not upscale the image if the original is smaller than the requested dimensions. If you wish to enable upscaling when using fit, you can use the fit_enlarge=1 option.

Default behaviour

/sample.li/castle_doc.jpg?w=500&h=200&
func=fit&bg_colour=b6d6f0

Here, a 400x100-pixel image is fitted into a canvas of 500x200 pixels.

Enabled upscaling

/sample.li/castle_doc.jpg?w=500&h=200&
func=fit&bg_colour=b6d6f0&fit_enlarge=1

With the fit_enlarge=1 option, the image is upscaled and then fitted into the 500x200-pixel canvas.

Setting image margins

If you requre a specific amount margin (solid color or transparent) between the original image and the image borders, you can use the margin=Xp parameter (X is in percent of the resized image). When the aspect ration does not allow the margin to be satisfied both horizontally and vertically, it will be treated as a minimum margin.