Skip to content

Advanced Features

Smart Cropping with Image CDNs - How Auto Crop Actually Works

Smart cropping uses face detection, subject detection, saliency, gravity, and focus points to crop images without cutting off important content. Learn when to use it and when to override it.

By · Editor

Last verified Jun 19, 2026

You crop one product photo into a square thumbnail and the model's head gets sliced off. Do that across hundreds of images and a handful of aspect ratios, and cropping each one by hand stops being realistic.

That is the problem smart cropping solves. It is automatic image cropping that keeps the important part of the image in frame — instead of blindly cropping from the center, an image CDN uses face detection, subject detection, saliency, gravity, or a manual focus point to decide what stays visible.

TL;DR: Use smart cropping for avatars, product thumbnails, cards, social previews, and responsive layouts where one source image needs many aspect ratios. Use face detection for people, automatic gravity/saliency for mixed editorial images, manual gravity when the subject position is predictable, and focus points when accuracy matters. Do not trust smart cropping blindly for hero images, important product shots, legal/medical content, or user-generated content where a bad crop can create bias or confusion.

Tip

The Safe Rule

Use smart cropping for repeated, lower-risk variants. Use manual review or saved focus points for images where the crop directly affects trust, conversion, brand, or meaning.

Tip

CDN Shortcut

Bunny Optimizer supports dynamic crop, aspect-ratio, gravity, and focus-crop parameters. Use coupon THEWPX for $5 free credit through this BunnyCDN signup link.


When Should You Use Smart Cropping?

Use smart cropping when the same image has to fit multiple boxes.

Use caseSmart crop?Best method
User avatarsYesFace detection
Author cardsYesFace detection or saved focus point
Product gridsUsuallyFocus point or gravity
Blog cardsYesAuto gravity/saliency
Social preview imagesYes, with QAAuto crop or focus point
Hero imagesBe carefulManual crop or pre-warmed smart crop
Legal, medical, safety imagesBe carefulManual review
Brand logosUsually noSVG, contain, or manual padding

Smart cropping is not magic. It is a practical way to avoid manually exporting 10 versions of every image.

The best use case is a repeatable template: square avatar, 4:3 card image, 16:9 blog thumbnail, 1:1 product grid, 9:16 story crop. If the crop is wrong, the layout still works but the image may look less useful. That is acceptable for low-risk variants.

For high-value images, I still prefer a manual crop or a saved focus point.


How Does Smart Cropping Work?

Smart cropping starts with a target box: for example, 400 x 400, 16:9, or 1200 x 630.

The CDN then decides which part of the source image should fit inside that box.

Face Detection

Face detection looks for human faces and tries to keep them inside the crop.

Use it for:

  • avatars
  • team pages
  • author photos
  • testimonial cards
  • speaker pages

Face detection is usually the most predictable smart-crop mode when faces are visible and large enough. It can still fail on side profiles, sunglasses, hats, low light, tiny faces, or group photos where not every face fits.

Automatic Gravity / Saliency

Automatic gravity looks for visually important areas.

Different providers use different names and models, but the idea is similar: find the region most likely to matter and crop around it. That may be a face, object, text-like region, high-contrast area, or predicted subject.

Use it for:

  • blog thumbnails
  • editorial images
  • mixed content feeds
  • lifestyle photos
  • images where the subject type varies

The downside is unpredictability. If several objects compete for attention, the algorithm may choose the wrong one.

Manual Gravity

Manual gravity is not AI. It is an anchor.

Examples:

  • north
  • south
  • east
  • west
  • center
  • northwest

Use it when you know the content pattern. If product shots always place the product in the bottom half, south may be better than center. If portraits usually need upper framing, north may work.

Manual gravity is simple and predictable. That is often better than "smart."

Focus Points

Focus points let you tell the CDN what matters.

Instead of asking the CDN to guess, you pass a coordinate such as 0.5,0.35 and crop around that point.

Use focus points when:

  • an editor selects the subject
  • product images have known focal coordinates
  • hero images need consistent art direction
  • automatic cropping gets it wrong too often

Focus points are the best compromise for serious image workflows: still automated, but not fully guessed.


How Do Image CDNs Implement Smart Cropping?

The exact parameters differ by provider, but the concepts are similar.

ProviderCommon smart-crop patternBest fit
Bunny Optimizercrop, aspect_ratio, crop_gravity, focus_cropSimple gravity and focus-point crops
Cloudinaryc_fill,g_auto, g_faces, g_auto:subjectAdvanced automatic crops and face/subject modes
ImageKitfo-auto, fo-face, fo-customAuto crop, face crop, custom focus
imgixfit=crop&crop=faces, crop=entropyFace and entropy-based crop workflows

Bunny Optimizer

Bunny's current cropping docs cover crop, aspect_ratio, crop_gravity, and focus_crop.

Examples:

?crop=400,300&crop_gravity=north
?aspect_ratio=16:9&width=1200
?focus_crop=400,300,0.5,0.4

crop_gravity is useful when the direction is predictable. focus_crop is useful when you know the subject point.

Cloudinary

Cloudinary's automatic gravity uses g_auto.

Example:

/c_fill,g_auto,w_400,h_400/image.jpg

Cloudinary documents g_auto for crop modes such as fill, lfill, fill_pad, thumb, crop, and auto. It can also be qualified with modes such as faces or subject depending on the transformation.

This is one of the stronger options when you want automated subject-aware art direction.

ImageKit

ImageKit uses fo-auto for automatic smart crop and fo-face for face-focused crops.

Example:

/tr:w-400,h-400,fo-auto/image.jpg
/tr:w-200,h-200,fo-face/user.jpg

ImageKit is a good fit when you want straightforward URL transformations and automatic focus behavior.

imgix

imgix commonly uses fit=crop with crop modes such as faces or entropy.

Example:

?fit=crop&crop=faces&w=400&h=400
?fit=crop&crop=entropy&w=1200&h=630

Entropy-based cropping can work well when the image has a clear high-detail subject, but it is not the same as semantic object understanding.


How Do You Implement Smart Cropping?

Avatars

Avatars need consistent size and face framing.

<img
  src="https://cdn.example.com/users/sunny.jpg?focus_crop=200,200,0.5,0.35"
  alt="Sunny Kumar profile photo"
  width="200"
  height="200"
/>

If your provider supports face detection, use that for general uploads. If an editor can set a focus point, use focus points for better control.

Product Cards

Product images need consistency across a grid.

<img
  src="https://cdn.example.com/products/chair.jpg?crop=600,600&crop_gravity=center"
  alt="Blue lounge chair"
  width="600"
  height="600"
  loading="lazy"
/>

For fashion, furniture, and marketplace images, center crop may not be enough. Use focus points when the product is not centered.

Blog Cards

Blog cards often need a 16:9 or 4:3 crop.

<img
  src="https://cdn.example.com/articles/image.jpg?aspect_ratio=16:9&width=800"
  alt="Image CDN dashboard screenshot"
  width="800"
  height="450"
  loading="lazy"
/>

For editorial images with unpredictable subjects, use your provider's auto gravity or smart crop mode.

Responsive Art Direction

Different viewports often need different crop ratios.

<picture>
  <source
    media="(min-width: 1024px)"
    srcset="https://cdn.example.com/hero.jpg?aspect_ratio=16:9&width=1600"
  />
  <source
    media="(min-width: 640px)"
    srcset="https://cdn.example.com/hero.jpg?aspect_ratio=4:3&width=1000"
  />
  <img
    src="https://cdn.example.com/hero.jpg?focus_crop=800,800,0.5,0.35"
    alt="Team photo"
    width="800"
    height="800"
  />
</picture>

This is where CDN cropping becomes useful: one original, multiple output crops, cached separately.

For lazy-loading rules around these responsive images, see lazy loading images with an image CDN.


What Can Go Wrong with Smart Cropping?

1. The Algorithm Picks the Wrong Subject

If the image has multiple faces, products, text blocks, or bright areas, the crop may focus on the wrong thing.

Fix: use focus points or manual gravity for important images.

2. It Cuts Off Product Context

A tight product crop may keep the object but remove scale, packaging, or surrounding context that matters to buyers.

Fix: test product images in the actual card size, not just in isolation.

3. It Creates Bias or Unfair Framing

Automated crops are model decisions. They can produce biased or socially awkward results.

Twitter's 2021 engineering post about its image-cropping algorithm is the well-known cautionary example. Their team shared findings around bias concerns in saliency cropping and changed how images were displayed.

Fix: avoid fully automatic cropping for sensitive user-generated content. Let users or editors adjust the crop.

4. It Adds First-Request Latency

Dynamic transformations usually cost more on the first uncached request. After that, the output should be cached.

Fix: pre-generate or pre-warm important crops, especially hero images and LCP candidates.

5. It Breaks Layout If Dimensions Are Missing

Smart crop does not protect you from CLS.

Fix: always include width and height, or reserve the aspect ratio in CSS.


Smart Cropping and Performance

Smart cropping can improve performance when it sends fewer pixels.

CSS object-fit: cover crops visually in the browser, but it still downloads the full source image. CDN cropping sends only the cropped/resized output. That can be a big win for thumbnails and cards.

Example:

  • Browser-only crop: download a 2000 x 1500 image, display it in a 400 x 400 box.
  • CDN crop: send a 400 x 400 derivative.

The CDN version transfers fewer bytes and decodes fewer pixels.

The caveat is cache. If every request creates a new unique crop size, you can reduce cache efficiency. Standardize your crop sizes:

  • 200 x 200 avatars
  • 600 x 600 product cards
  • 800 x 450 blog cards
  • 1200 x 630 social cards
  • 1600 x 900 desktop hero crops

Predictable sizes cache better.

For broader image performance context, read will an image CDN make my website faster? and do image CDNs improve LCP?.


Smart Cropping and SEO

Smart cropping is usually SEO-safe when the final image still matches the content and alt text.

Problems happen when the crop changes meaning.

Bad examples:

  • alt text says "woman holding red handbag" but the crop cuts off the handbag
  • product image crop removes the product label
  • recipe image crop removes the dish and keeps the background
  • team photo crop cuts out people mentioned nearby

The SEO rule is simple: the visible cropped image should still match the surrounding content and alt text.

Also keep URLs stable where possible. If your CDN uses transformation parameters, avoid creating a random new URL for every render. Stable transformation patterns are easier to cache, inspect, and debug.

For CDN SEO details, read can image CDNs hurt SEO?.


Smart Cropping Best Practices

1. Start with good originals

Smart cropping cannot fix a bad source image. Leave enough space around the subject.

2. Standardize output sizes

Use a small set of crop dimensions. This improves cache hit rate and design consistency.

3. Use focus points for high-value images

Automatic crop is fine for low-risk variants. Important images deserve a saved focal point or manual review.

4. Do not smart-crop the LCP image cold

If the hero image is transformed dynamically, pre-warm the URL or use a pre-generated crop.

5. Test with real uploads

Stock photos are too clean. Test with messy user uploads, group shots, side profiles, screenshots, and product photos with uneven framing.

6. Keep fallbacks

If face detection fails, know what happens next. Center crop? Entropy crop? Original aspect ratio? Provider behavior differs.


Frequently Asked Questions

What is smart cropping?

Smart cropping is automatic cropping that tries to keep the important part of an image in frame. It can use face detection, subject detection, saliency, gravity anchors, or manual focus points depending on the CDN and settings.

Is smart cropping the same as object-fit cover?

No. CSS object-fit: cover crops visually in the browser after downloading the image. CDN smart cropping creates a smaller cropped image before delivery, so the browser downloads fewer pixels.

When should I use face detection cropping?

Use face detection for avatars, author photos, team pages, testimonial cards, and people-focused thumbnails. Avoid relying on it for landscapes, products, food photos, or group images where all people must stay visible.

What happens if smart cropping chooses the wrong subject?

Provider behavior differs, but the visible crop will be wrong until you override it. Use manual gravity, focus points, or editorial review for important images where a bad crop would hurt trust or meaning.

Does smart cropping hurt performance?

It can add processing time on the first uncached request, but cached derivatives should be fast. It often improves performance overall by sending a correctly sized crop instead of a full oversized image.

Can I combine smart cropping with WebP or AVIF conversion?

Yes. Most image CDNs can crop, resize, compress, and convert format in the same delivery pipeline. The CDN generates the transformed derivative and caches it for later requests.

Should I use smart cropping for hero images?

Use it carefully. Hero images affect LCP and brand presentation. If you use smart cropping for a hero, pre-warm the transformed URL and manually inspect the result across desktop and mobile crops.

Summing Up!

Smart cropping is useful when one source image needs many output shapes: avatars, product cards, blog thumbnails, social previews, and responsive layouts. It saves manual editing and can reduce downloaded pixels.

But smart cropping is not something I would blindly apply to every image. Face detection fails, saliency can pick the wrong subject, and automated crops can create bias or remove important context.

Use automatic crop for repeatable low-risk variants. Use focus points or manual crops for important images. Then combine cropping with CDN resizing, WebP/AVIF conversion, dimensions, and caching so the page is faster and the image still means what it should.

Free$5Credit
Live Offer

BunnyCDN · $0.01/GB

CodeTHEWPX
Claim