Cloudimage - Documentation

Aspect ratio crop

Sets target aspect ratio or aspect ratio range when cropping.

aspect_ratio=AR

aspect_ratio=AR1,AR2

Aspect ratios can be set as decimal values (1.778) or ratios (16:9).

Crop and resize

If you provide only one dimension parameter (eg. width) and aspect_ratio, the other dimension (height) will be calcualted.

If you include both width and height in the URL, aspect_ratio is ignored.

Original image

Aspect ratio 3:2 (1.5).

/sample.li/car1.jpg?w=400

Photo alt \#responsive

Aspect ratio crop

Aspect ratio 1.8, image is cropped to match it.

/sample.li/car1.jpg?w=400&aspect_ratio=1.8

Photo alt \#responsive

Crop without resize

If you provide only aspect_ratio and no dimensions (width or height), the image will be cropped without resizing.

Original image

Aspect ratio is 1.323.

/sample.li/frog.png

Photo alt \#responsive

Aspect ratio crop

Image is cropped to 1.5-2.0 without scaling.

/sample.li/forg.png?aspect_ratio=1.5

Photo alt \#responsive

Aspect ratio range

You can spcify a range of aspect ratio, for example aspect_ratio=4:3,16:9. Images which fall within this range, will not be cropped. Wider or taller images will be cropped to the closer aspect ratio.

Original image

Aspect ratio 3:2 (1.5).

/sample.li/car1.jpg?w=400

Aspect ratio range crop

Aspect ratio is in range, image is not cropped.

/sample.li/car1.jpg?w=400&aspect_ratio=1.5,2.0

Photo alt \#responsive

Original image

Aspect ratio 2.25:1.

/sample.li/kids.jpg?w=400

Photo alt \#responsive

Aspect ratio range crop

Aspect ratio is not in range, image is cropped to 2.

/sample.li/kids.jpg?w=400&aspect_ratio=1.5,2.0

Photo alt \#responsive