Crop
Image Cropping Transformations
Crop Modes
Control how your image is cropped using the c_{mode}
parameter. Each mode handles dimensions differently:
crop
- Exact Dimensions
Crops the image to exactly match the specified dimensions, removing excess pixels.
- Best for: Fixed-size containers where exact dimensions are required
- Behavior: May remove parts of the image to achieve exact size
- Example use: Profile pictures, thumbnails
- Supports smart cropping with gravity controls
fill
- Smart Resize and Crop
Resizes the image to fill the specified dimensions while maintaining aspect ratio, then crops excess pixels.
- Best for: Hero images, featured content
- Behavior: Ensures entire space is filled without distortion
- Example use: Blog post headers, product featured images
- Supports smart cropping with gravity controls
fit
- Preserve Content
Resizes image to fit within specified dimensions while maintaining aspect ratio, with no cropping.
- Best for: Product images, artwork
- Behavior: May leave empty space on sides or top/bottom
- Example use: Product galleries, image collections
scale
- Simple Resize
Basic resize that may change aspect ratio to match exact dimensions.
- Best for: When aspect ratio isn’t critical
- Behavior: May stretch or compress image
- Example use: Background patterns, non-critical images
limit
- Downscale Only
Only scales down images that are larger than specified dimensions.
- Best for: User-uploaded content
- Behavior: Never enlarges small images
- Example use: Forum attachments, user galleries
pad
- Add Padding
Resizes within dimensions and adds padding to reach exact size.
- Best for: Consistent layouts requiring exact dimensions
- Behavior: Adds padding to maintain aspect ratio
- Example use: Product grids, image galleries
Gravity Control
Use g_{position}
to control the focal point during cropping. Only works with crop
and fill
modes:
Standard Positions
Smart Gravity
Available for crop
and fill
modes:
Supported objects
We currently support the following objects:
airplane
apple
backpack
banana
baseball bat
baseball glove
bed
bench
bicycle
bird
boat
book
bottle
bowl
broccoli
bus
cake
car
carrot
cat
cell phone
chair
clock
couch
cow
cup
dining table
dog
donut
elephant
fire hydrant
fork
frisbee
giraffe
hair drier
handbag
horse
hot dog
keyboard
kite
knife
laptop
microwave
motorcycle
mouse
orange
oven
parking meter
person
pizza
potted plant
refrigerator
remote
sandwich
scissors
sheep
sink
skateboard
skis
snowboard
spoon
sports ball
stop sign
suitcase
surfboard
teddy bear
tennis racket
tie
toaster
toilet
toothbrush
traffic light
train
truck
tv
umbrella
vase
wine glass
zebra