Skip to content

Image Transformation API

If an uploaded file is an image, you can transform it on the fly just adding query string parameters.

Resizing

width

The width of the output image. Value is a positive integer, interpreted as pixel width. The resulting image will be width pixels wide.

If only one dimension is specified, the other dimension will be calculated according to the aspect ratio of the input image. If both width and height are omitted, then the source image's dimensions are used.

GET https://api.apisful.com/v1/files/.../my-image.png?width=500

height

The same as width:

GET https://api.apisful.com/v1/files/.../my-image.png?width=500&height=500

fit

The fit parameter controls how the output image is fit to its target dimensions after resizing.

Valid values are clip, scale. The default value is clip.

clip

Default. Resizes the image to fit within the width and height boundaries without cropping or distorting the image. The resulting image will match one of the constraining dimensions, while the other dimension is altered to maintain the same aspect ratio of the input image.

clip illustration

scale

Scales the image to fit the constraining dimensions exactly. The resulting image will fill the dimensions, and will not maintain the aspect ratio of the input image.

scale illustration

Quality

Controls the output quality of lossy file formats (jpg, pjpg, webp, or jxr).

Valid values are in the range 0 – 100 and the default is 75. Quality can often be set much lower than the default, especially when serving high-DPR images