Bunny Optimizer is a real-time on the fly image manipulation and optimization service that automatically optimizes your images for faster image delivery, bandwidth savings and enables smart dynamic image manipulation using a simple query API.
This article explains the image optimizer engine query API.
- Width
- Height
- Aspect Ratio Crop
- Quality
- Sharpen
- Blur
- Crop
- Crop Gravity
- Flip
- Flop
- Brightness
- Saturation
- Gamma
- Hue
- Contrast
- Automatic Optimization
- Force Image Optimization
Width
Parameter: width Units: Pixels Default: auto
Resize the output image to the given width maintaining the current aspect ratio.
?width=300 |
?width=200 |
?width=150 |
Height
Parameter: height Units: Pixels Default: auto
Resize the output image to the given height maintaining the current aspect ratio.
?height=150 |
?height=125 |
?height=75 |
Aspect Ratio Crop
Parameter: aspect_ratio Default: auto
Automatically crop the output image into the given aspect ratio with a central gravity.
?aspect_ratio=1:1 |
?aspect_ratio=16:9 |
?aspect_ratio=2:4 |
Quality
Parameter: quality Units: Percent Range: 0-100 Default: 85
Optimize the output image to the given compression level, 0 being the lowest and 100 being the highest. Lowering the quality will reduce file size, but might start visibly reducing image quality with values below 70.
?quality=100 |
?quality=40 |
?quality=5 |
Sharpen
Parameter: sharpen Units: Boolean Default: false
Sharpen the output image.
?sharpen=false |
?sharpen=true |
Blur
Parameter: blur Units: Number Range: 0-100 Default: 0
Blur the output image.
?blur=0 |
?blur=25 |
?blur=80 |
Crop
Parameter: crop Units: Pixels Format 1: width,height Format 2: width,height,x,y
Crop the output image to the given width and height. Two formats are accepted. Format 1 one only includes the width and height of the crop. Format 2 also includes the X and Y position where the crop should start. Image resizing with the width and height parameters is processed after the crop and the resized measurements apply.
If only width and height are given, the Crop Gravity parameter will be used.
?crop=3500,3500 |
?crop=3500,3500,250,300 |
?crop=300,300 |
Crop Gravity
Parameter: crop_gravity Default: center
Values: center,forget,east,north,south,west,northeast,northwest,southeast,southwest
Set the gravity of the crop operation. This is used with the Format 1 cropping only and snaps the crop to the selected position.
?crop_gravity=center |
?crop_gravity=west |
?crop_gravity=east |
Flip
Parameter: flip Units: Boolean Default: false
Flip the output image vertically.
?flip=false |
?flip=true |
Flop
Parameter: flop Units: Boolean Default: false
Flip the output image horizontally.
?flop=false |
?flop=true |
Brightness
Parameter: brightness Units: Number Range: -100-100 Default: 0
Adjusts the brightness of the output image.
?brightness=0 |
?brightness=15 |
?brightness=-15 |
Saturation
Parameter: saturation Units: Number Range: -100-100 Default: 0
Adjusts the saturation of the output image. Use -100 for grayscale.
?saturation=0 |
?saturation=50 |
?saturation=-60 |
Hue
Parameter: hue Units: Number Range: 0-100 Default: 0
Adjusts the hue of the output image by rotating the color wheel. The default value of 0 is the base color and increasing the value modulates to the next color for each 33 change.
?hue=0 |
?hue=33 |
?hue=66 |
Gamma
Parameter: gamma Units: Number Range: -100-100 Default: 0
Adjusts the gamma of the output image.
?gamma=0 |
?gamma=-25 |
?gamma=25 |
Contrast
Parameter: contrast Units: Number Range: -100-100 Default: 0
Adjusts the contrast of the output image.
?contrast=0 |
?contrast=20 |
?contrast=-20 |
Automatic Optimization
Parameter: auto_optimize Units: String Values: low,medium,high Default: none
Automatically enhance the output image with multiple levels of optimizations. With high, sharpening is also applied automatically.
?auto_optimize=low |
?auto_optimize=medium |
?auto_optimize=high |
Force Image Optimization
Parameter: optimizer Units: String Values: image Default: none
In the event your image is not detected correctly by the Optimizer, such as no file extension or content-type, you can use this parameter to force the optimization.