Skip to content
Cloudflare Images
Visit Cloudflare Images on GitHub
Set theme to dark (⇧+D)

Resizing Images

Cloudflare Images supports Variants that specify how you would like to resize images for different use cases. You can configure up to 20 variants.

Each variant has properties including the width and height of resized images.

Configure variants in Cloudflare Images

The fit property describes how the width and height dimensions should be interpreted. The chart below describes each of the options:

Fit OptionsBehavior
Scale DownImage will be shrunk in size to fully fit within the given width or height, but won’t be enlarged.
ContainImage will be resized (shrunk or enlarged) to be as large as possible within the given width or height while preserving the aspect ratio.
CoverImage will be resized to exactly fill the entire area specified by width and height, and will be cropped if necessary.
CropImage will be shrunk and cropped to fit within the area specified by width and height. The image won’t be enlarged. For images smaller than the given dimensions it’s the same as scale-down. For images larger than the given dimensions, it’s the same as cover.
PadImage will be resized (shrunk or enlarged) to be as large as possible within the given width or height while preserving the aspect ratio, and the extra area will be filled with a background color (white by default).