Image Transforms
Manipulate images using standard resizing, scaling, and cropping operations.
QueryString API
width
constrains the image width.w
is an alias forwidth
height
constrains the image height.h
is an alias forheight
dpr
is a multiplier forwidth
/height
to make responsive image usage easier.mode
determines how to handle aspect ratio differences.stretch
distorts the image to be exactly the given dimensions, ifscale=both
. Ifscale=down
(the default), the image is only scaled ifwidth
andheight
are smaller than the image.pad
scales the image to fit withinwidth
andheight
, then pads 2 edges (bgcolor
) to make it.crop
scales the image to fit abovewidth
andheight
, then minimally crops to meet aspect ratio.max
scales the image to fit withinwidth
andheight
scale
controls whether images are upsampled or not.down
- Never upscale an image - return at original size insteadboth
- Downscale or upscale to meet size requirements. Image enlargement causes blurriness and should be avoided.canvas
- Add padding instead of upscaling to meet size requirements.up
- Never downscale, only upscale to meet requirements. Rarely used.
anchor
determines how the image is aligned when you usemode=crop
,mode=pad
orscale=canvas
. The default ismiddlecenter
values are
topleft
,topcenter
,topright
,middleleft
,middlecenter
,middleright
,bottomleft
,bottomcenter
, andbottomright
.
sflip
flips the source image in thex
,y
, orxy
dimensions.flip
flips the result image in thex
,y
, orxy
dimensions.srotate
rotates the source image90
,180
, or270
degrees.rotate
rotates the result image90
,180
, or270
degrees.crop=x1,y1,x2,y2
crops the source image to the given coordinates. If x2 or y2 are negative, they are relative to the bottom-right corner of the image.crop=10,10,-10,-10
removes 10 pixels from the edge of the image.cropxunits=100&cropyunits=100
makes thecrop
coordinates percentages of the image instead of pixels.trim.threshold=80
specifies a threshold to use for trimming whitespace.trim.percentpadding=0.5
specifies percentage of padding to restore after trimming.bgcolor
must be in the form RGB, RGBA, RRGGBBAA, RRGGBB, or be a named color.bgcolor
determines the color of padding added withmode=pad
orscale=canvas
.ignoreicc=true
causes the source image's color profile to be ignored and treated as sRGB.ignore_icc_errors=true
causes color profile errors to be ignored rather than causing the operation to fail.
Last updated