Image operations

Basic image resizing operations

Resizing operations enable the dynamic generation of image transformations to meet various web delivery use cases. Operations focus on the image size while Image filters allow to modify the image itself.

Most of the on-the-fly image transformations can be configured using the Asset Variation Builder, an in-line URL builder to preview each image transformation instantly.

Available operations

Operation
Syntax
Description

width=X

resizes the image width to X pixels while keeping original aspect ratio

height=X

resizes the image height to X pixels while keeping original aspect ratio

org_if_sml=1

prevents upscaling if any of the target dimensions is larger than the origin image

func=crop

resizes the image to the desired dimensions without distorting it while cropping out portions of the image if necessary, to achieve the desired aspect ratio. You need to also provide both width and height

gravity=X

defines the desired "focal point" of the image. Used with func=crop, this will set the part of the image which will be retained. With the func=fit resize mode, it will set the placement of the image within the new canvas X = [north | south][east | west] | auto | smart | trim | X,Y

tl_px=X,Y

defines the coordinates of the top left corner of the cropping rectangle when performing positionable crop

br_px=X,Y

sets coordinates of the bottom right corner of the cropping rectangle when performing positionable crop

func=face

crops the image automatically focusing on the most prominent face in the image (if a face is detected)

func=fit

resizes the image to the desired dimensions without distorting it by increasing the image canvas if necessary, to achieve the desired aspect ratio

margin=X

sets the minimum margin when using the fit resize mode

func=cropfit

resizes the image while automatically choosing between the crop and fit resize modes depending on the origin image dimensions, the desired dimensions, and the other parameters in the transformation URL

func=bound

resizes the image to dimensions no larger than the ones specified in the transformation URL. The resulting image might not match both width and height depending on the desired aspect ratio

func=boundmin

resizes the image to dimensions no larger than the larger one specified in the transformation URL. The resulting image might not match both width and height depending on the desired aspect ratio

func=cover

resizes the image to the set width and hight while ignoring the origin aspect ratio (image might be distorted)

flip=[h][v]

mirrors the image horizontally and/or vertically

r=X

rotates the image to an arbitrary angle of X degrees (counterclockwise)

trim=X

trims any solid-color border (if present); X is the aggressiveness of the operation

radius=X

rounds the corners of the image while optionally fills the empty background with a chosen color

bg_remove=1

removes the background of the image using AI

Do not hesitate to contact us if you need any additional operations not listed above

Resize functions

When you resize an image by specify both width and height, the original image proportions can be either ignored or maintained. You may also choose to add padding to the image to fill the blank space (extending the canvas).

Cloudimage supports the following resize functions (defined with the func parameter):

Crop

Keeps image proportions, cutting the image to fit the defined width and height; see Crop

Fit

Resizes the image, keeping proportions and extending the canvas (by adding padding) to satisfy the desired dimensions; see Fit

Cropfit

Performs either Cropor Fit based on the image dimensions, aspect ratio and transformation parameters; see Cropfit

Preview
Syntax

Same parameters, 400x250 origin image, resolves to "fit": /samples.scaleflex.com/ny_doc.jpg?func=cropfit&w=500&h=350&bg_colour=auto

Bound

Fits image in a box of defined size without adding padding; see Bound

The boundmin operation is a special case of bound where the smaller dimension is respected instead of the larger one; see Boundmin

Cover

Resizes the image to the given width and height, ignoring original image proportions, thus distorting the image; see Cover

For troubleshooting purposes, use the ci_info=1 operation to view details about resizing and compression, for example, /sample.li/hotel.jpg?w=400&ci_info=1

Last updated

Was this helpful?