Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.bunny.net/llms.txt

Use this file to discover all available pages before exploring further.

Resize images to specific dimensions while automatically maintaining aspect ratio. Generate responsive images for different screen sizes, create consistent thumbnails, or optimize oversized images for faster loading.
When both width and height are specified, Bunny Optimizer automatically uses whichever produces the smaller image while preserving aspect ratio.

Parameters

width
integer
Resize the image to match the given width in pixels while maintaining aspect ratio.Unit: pixels
height
integer
Resize the image to match the given height in pixels while maintaining aspect ratio.Unit: pixels
upscaling
string
Allows the image to be enlarged beyond its original dimensions.Values: off, resamplingDefault: off
The default upscaling behaviour can be changed to resampling (so you don’t need to specify the query parameter each time) in the Pull Zone config via the Update Pull Zone API by setting OptimizerEnableUpscaling to true.

How it works

When you apply width or height parameters, Bunny Optimizer:
  1. Calculates the new dimensions based on your specified value
  2. Maintains the original aspect ratio automatically
  3. Resizes the image proportionally
  4. Delivers the optimized result from the edge cache

Usage

Width-based resizing

Specify a width to resize the image proportionally. The height adjusts automatically to maintain aspect ratio. Ideal for creating responsive images where you need consistent widths across different screen sizes or generating multiple sizes for srcset attributes.
https://yourzone.b-cdn.net/image.jpg?width=300
Originalwidth=300
Original imageResized to 300px width
Smaller width
https://yourzone.b-cdn.net/image.jpg?width=150
Originalwidth=150
Original imageResized to 150px width

Height-based resizing

Specify a height to resize the image proportionally. The width adjusts automatically to maintain aspect ratio. Perfect for layouts where vertical space is constrained, such as horizontal carousels, fixed-height containers, or product listing grids.
https://yourzone.b-cdn.net/image.jpg?height=150
Originalheight=150
Original imageResized to 150px height
Smaller height
https://yourzone.b-cdn.net/image.jpg?height=100
Originalheight=100
Original imageResized to 100px height

Combining width and height

When both width and height are specified, Bunny Optimizer intelligently selects whichever produces the smaller image while preserving aspect ratio. This ensures images fit within specific layout constraints while maintaining their original proportions.
https://yourzone.b-cdn.net/image.jpg?width=100&height=75
Given an image with dimensions 500×333:
width=100height=75width=100&height=75 (result)
Resized by widthResized by heightBoth parameters applied
In this example, height=75 produces a smaller image (113×75) compared to width=100 (100×67), so the height parameter takes effect.

Combining with other transformations

Resizing works seamlessly with other Bunny Optimizer parameters. Reduce bandwidth by combining with quality adjustments, convert formats for better compression, or apply filters to enhance resized images:
Resize with quality adjustment
https://yourzone.b-cdn.net/image.jpg?width=800&quality=85
Resize with format conversion
https://yourzone.b-cdn.net/image.jpg?width=600&format=webp
Resize with sharpen filter
https://yourzone.b-cdn.net/image.jpg?height=400&sharpen=3
Crop operations have priority over width or height parameters. If any crop is defined in the query, it will be applied first, then resizing is applied to the cropped result.

Upscaling

By default, Bunny Optimizer does not enlarge images beyond their original size. Use upscaling=resampling to permit standard resampling-based upscaling. When enabled, upscaling is limited to an output size of 24 megapixels while preserving aspect ratio. This limit applies only when the result would be larger than the original image. If the original image is already larger than 24 megapixels, it is not reduced unless another transformation requires it.
Upscale 1024x512 image to 2048x1024
https://yourzone.b-cdn.net/image.jpg?width=2048&upscaling=resampling
Upscale 1024x512 image to 1536x768
https://yourzone.b-cdn.net/image.jpg?width=1536&height=768&upscaling=resampling
Downscale 1024x512 image to 512x256. No upscaling (target is smaller than original).
https://yourzone.b-cdn.net/image.jpg?width=512&upscaling=resampling