惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
P
Proofpoint News Feed
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
罗磊的独立博客
J
Java Code Geeks
月光博客
月光博客
F
Full Disclosure
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
U
Unit 42
WordPress大学
WordPress大学
A
About on SuperTechFans
C
Cyber Attacks, Cyber Crime and Cyber Security
SecWiki News
SecWiki News
Security Latest
Security Latest
C
Check Point Blog
C
CERT Recently Published Vulnerability Notes
小众软件
小众软件
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
V
Visual Studio Blog
博客园_首页
NISL@THU
NISL@THU
I
Intezer
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
The Register - Security
The Register - Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Latest news
Latest news
Project Zero
Project Zero
博客园 - 叶小钗
C
Cybersecurity and Infrastructure Security Agency CISA
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy International News Feed
博客园 - 【当耐特】
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
V
Vulnerabilities – Threatpost
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网

ImageKit.io Blog

Next.js Image Optimization with ImageKit Use Video as a Background in Your Next.js Project How to Fix Autoplay Video in Next.js How Durian Scaled a Visual-First Retail Experience to 350K Monthly Visitors Online How Matsmart accelerated image delivery across countries with ImageKit AI in Digital Asset Management: From Smart Workflows to Agentic Automation How Joseph Joseph unified and secured global video delivery with ImageKit How Modall powers fast, effortless media delivery across 40+ projects with ImageKit Digital Asset Management (DAM) Trends: 2026 Report How to add a poster image to Video.js player (and automate it) HLS streaming with Video.js + React Building the future of storytelling with fast, AI-powered video delivery How PushOwl delivers 100M+ image-rich notifications seamlessly with ImageKit How Homify delivers millions of interior design images seamlessly with ImageKit Better event discovery with lightning‑fast videos & images Adding video player in React Native Video player in Angular applications Crop and resize videos in React Next.js image and video upload React image and video upload React video optimization How we quadrupled our traffic to 625K monthly page views How Apollo 24|7 boosted performance & reduced costs with ImageKit Simplify your media workflows with ImageKit DAM integrations Extending Lighthouse for custom image and video optimization analysis Brand Asset Management: What is it? How does it work? WordPress Digital Asset Management Guide - Manage your WP media assets better Why Shopify retailers need a digital asset management solution DAM vs. SharePoint: Which is best for you? AI-powered Metadata and Tagging in Digital Asset Management How Hopscotch built India's largest online Kids' fashion brand with ImageKit Dropbox Vs. DAM: Which Is The Right Tool For Digital Asset Management Digital Asset Management for Photographers: A Complete Guide Why digital asset management for agencies is essential Helping both Top and Bottom Line: SaffronStays rapid, profitable growth with ImageKit How KreditBee simplified media experiences with ImageKit Google Drive alternatives for businesses (with fast-growing teams) Node.js image upload ImageKit: The Secret Ingredient in Swiggy’s Expansion Journey Streamlining the Design Approval Process: A Comprehensive Guide AV1 Codec - Complete guide for video application devs PHP image and video upload Angular image & video upload AV1 vs VP9: Which codec should you choose? Adding video player in Next.js React Video Player VP8 vs VP9 - In the context of online video delivery Exploring WebM vs MP4 7 Free Digital Asset Management Software that are not Open-Source Comparing 9 Top Digital Asset Management Tools in the Market What are Brand Standards and Why do they Matter? Boost Sales and Brand Appeal: Essential Tips for eCommerce Image Management Brand Recall: The Strategy to Create Unforgettable Brands How to upload files in HTML? Branding for Small Businesses (2025 Edition) Everything you need to know about VP9 codec Recent updates from ImageKit and what's next Best Ways to Write RFP For Digital Asset Management (+ with free RFP template) What is Brand Dilution? How to Avoid It? Explained with [Examples] The Importance of Brand Identity: Leveraging Digital Asset Management for Impact From Launch to Scale: How to Launch a Brand Campaign Digital Asset Management Requirements - What do You Need to Evaluate and How? Marketing Collateral Management: A Quick End-to-End Guide Video Content Management System: What Is It And How To Choose One? Dropbox vs. Google Drive vs. Onedrive: The Best Cloud Storage Solution How to Build Brand Trust: Get Started In 2025 Google Drive vs. Box: A Detailed Comparison How Digital Asset Management Solutions Help Protect Brand Equity A DAM Solution Can Safeguard Your Digital Intellectual Property - Here’s How WebP Vs. PNG: Which Image Format Should You Use and Why? How to Resize Images in Bootstrap Easily Progressive jpegs (PJPEG): the key to loading images faster on your website Dropbox vs. Google Drive: The Best Cloud Storage For Digital Assets Dropbox Pros & Cons In 2024: An In-Depth Analysis and Why A DAM Solution Stands Out Google Drive Vs OneDrive: The Better Storage Option For Digital Assets Manage your video assets better with video metadata Understanding DAM's Role in Strengthening Brand Identity Digital asset management strategy: What to know before creating one The Ultimate Guide To Marketing Agency Onboarding 6 Solutions To Simplify Large File Sharing Over The Web A Step-by-Step Breakdown of a Video Production Workflow 13 Digital Asset Management Use Cases You Should Know How to Conduct a Brand Audit and Manage Your Brand Assets Costly Consequences of Inconsistent Branding And How DAM Can Help Dynamic Asset Transformation: What It Is, Why You Need It, and How ImageKit Can Help Everything You Need to Know About HTML Video Autoplay How To Select Your DAM Vendor: A Complete Guide How to Boost User Experience with Smart Digital Asset Management React Image Optimization: A Guide for Web Developers Why Should DAM Be A Part Of Your MarTech Stack? Unleashing the Power of Content Repurposing with ImageKit MKV vs MP4: Which Video File Format Is Better for Your Needs? Digital Asset Management For Ecommerce: A Complete Guide How an Image Tagging Software can Transform Your Image Search How to Manage Your Content Lifecycle Effectively M4V vs MP4: Which Video Format Should You Use and Why? Why Every Business Needs An Image Management System All The Questions To Ask During A Dam Demo Which is the Best Image Format for Your Website? Uploading Multiple Files Using JavaScript: A Comprehensive Guide
Advanced Smart Crop — Intelligent, Automatic Image Cropping
Manu Chaudhary · 2017-08-29 · via ImageKit.io Blog

We have made significant improvements to our Smart Crop algorithm making automatic image crops even better. With improved face detection, feature detection, a new object-aware crop mode with 80+ named objects, and other crop modes, the new algorithms provide higher cropping accuracy for facial, non-facial, and multi-object images. We have updated the text and examples to demonstrate this improvement.

Each image is different. Each device is different. Therefore, each image needs to be treated differently to build a perfect responsive experience across devices. Smart Crop is a feature that intelligently looks at the content of an image and automatically focuses on the most important part of an image for cropping.

What is Smart Crop?

When we resize images for different devices or placeholders, and the aspect ratio of the requested size does not match that of the original image, some cropping is bound to take place on the sides of the image. That is when we do not want to stretch or skew the image forcefully.

This can be seen from the graphic below, where we request a 1:1 aspect ratio output from a 4:3 aspect ratio input image -

Now, since cropping would take place unavoidably in these circumstances, if the subject of the image is not in the centre then it would get cropped out of the image.

For example, if I try to resize the image below to get a squared thumbnail, the sides of the image (the buildings) will get cropped away.

Original Image
Original Image
demonstrate cropping while resizing
demonstrate cropping while resizing
A 200x200 image, buildings get cropped on the sides with regular cropping
A 200x200 image, buildings get cropped on the sides with regular cropping

Smart Crop is a way of intelligently determining the most important part of the image and keeping it in focus while cropping the image. By using this feature you would be able to generate perfect thumbnails that are centred on the image's subject, or the object you specify, or the most important feature with a high probability.

Let's take the original image below as an example and see how Smart Crop can automatically center around the bicycle, when the default center crop leaves it out.

Original Image
Original Image

Default Crop Mode: The bike gets cropped out here

A 400x400 thumbnail with default cropping, the bike gets cropped out'
A 400x400 thumbnail with default cropping, the bike gets cropped out'

Auto Smart Crop Mode: The bike is now in the center of the thumbnail automatically.

A 400x400 thumbnail with smart crop that brings the bicycle in the center
A 400x400 thumbnail with smart crop that brings the bicycle in the center

As demonstrated, ImageKit's Smart Crop could intelligently identify the key object in the image and preserved it in the final thumbnail.

How do we determine the most important part of the image?

There are a few different ways in which Smart Crop works in ImageKit to identify the area to crop around. It depends on the mode of smart crop you use in the URL.

Smart cropping algorithm in auto crop mode: In this mode, ImageKit tries to detect faces in the image using machine learning. If a face (or multiple faces) are found, we center around them as closely as possible. If ImageKit cannot find a face in the image, we try to do a feature detection on the image. The center of such non-facial features is then used to calculate the cropping dimensions on the original image.

Smart cropping algorithm in face crop mode: In this mode, we try to detect a face in the image and crop closely around that. If multiple faces are found, we crop around the most prominent face (determined by the number of pixels occupied) found in the image.

Smart cropping algorithm in object-aware crop mode: In this mode, we use machine learning to find the object mentioned in the URL inside the image. If the object is found, the crop is created around it.

Different modes of Smart Crop in ImageKit

ImageKit offers three crop modes to use with smart cropping - the auto crop mode, the face crop mode, and the object-aware crop mode.

Auto and Face-crop mode in Smart Crop

In auto crop mode, we try to preserve as much of the image as possible, while centering on the most important part of the image. This is useful when you are trying to create an image gallery. Each thumbnail in that gallery will contain the most important part of the image. You need to use the "fo-auto" transform for this crop mode.

In the face crop mode, we try to extract out the largest face from the image, and the rest of the image is discarded. This is useful when you are trying to create profile pictures from a larger image. You need to use the "fo-face" transform for this crop mode.

For example, let's use the image below and run both auto and face crops on the same image to understand how the two work.

Original image

Original image
Original image

Smart crop with "auto" crop mode: The thumbnail centers around the boy instead of the center of the image, but it also includes the parts of the image around the boy.

Auto crop mode centers around the key object identified in the image
Auto crop mode centers around the key object identified in the image

Smart crop with "face" crop mode: The thumbnail is cropped tightly around the boy's face

Face crop mode crops tightly around a face identified in the image
Face crop mode crops tightly around a face identified in the image

You can also control the zoom in face crop mode using the zoom (z) parameter in ImageKit. Specifying a value less than 1, zooms out of the face, whereas a value greater than 1, zooms into the face. For example, to zoom out from the face in the above example, we can add z-0.75 to the URL.

https://ik.imagekit.io/ikmedia/Graphics/smart_crop/Smart_crop_example.jpg?tr=w-300,h-300,fo-face,z-0.75

The output is a less tight crop around the face.

Face crop in ImageKit, but zoomed out to add some breathing space around the face
Face crop in ImageKit, but zoomed out to add some breathing space around the face

Object-aware cropping mode

As an extension of smart crop and face crop, object-aware crop can be used when you want to single out a specific object from a multi-object image.

Use the parameter fo-<object name> in your URL to carry out the transformation and you can choose from a variety of 80+ objects ranging from food, drink, animals, everyday essentials and more. The full list of objects that can be identified in an image can be found here.

For example, if you have an image of a living room, you can crop around the couch or the chair by specifying the focus parameter as couch or chair in the URL transformation, respectively.

Original Image of the living room

Original image
Original image

Cropped around the couch

Image cropped around the couch using object-aware cropping in ImageKit
Image cropped around the couch using object-aware cropping in ImageKit

Cropped around the chair

Image cropped around the chair using object-aware cropping in ImageKit
Image cropped around the chair using object-aware cropping in ImageKit

How can I start using Smart Crop for images?

Like all other image transformations and optimizations in ImageKit, this feature too works in real-time by simply adding a parameter to the URL. In this case, we need to set the value of "focus" in the transformation string to "auto" (for auto crop mode) or "face" (for face crop mode) or <object-name> (for object-aware crop mode).

For auto and face crop modes to work, you need to specify both, height and width of the output image. If you specify only the height or the width, then ImageKit maintains the aspect ratio without cropping. You can read more about different focus modes in our detailed documentation here.

If your normal thumbnail URL is

https://ik.imagekit.io/demo/img/tr:h-200,w-200/default-image.jpg

To enable Smart Crop with auto crop mode, this URL will change to

https://ik.imagekit.io/demo/img/tr:h-200,w-200,fo-auto/default-image.jpg

To enable Smart Crop with face crop mode, this URL will change to

https://ik.imagekit.io/demo/img/tr:h-200,w-200,fo-face/default-image.jpg

To enable Smart Crop with object-aware crop around a "couch", this URL will change to

https://ik.imagekit.io/demo/img/tr:h-200,w-200,fo-couch/default-image.jpg

Examples of Smart Crop in action (Auto-Mode)

Example 1

Original image
Original image
200x200 thumbnail with center crop
200x200 thumbnail with center crop
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with auto smart-crop mode

Example 2

Original image
Original image
200x200 thumbnail with center crop
200x200 thumbnail with center crop
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with auto smart-crop mode

Example 3

Original image
Original image
200x200 thumbnail with center crop
200x200 thumbnail with center crop
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with auto smart-crop mode

Examples of Smart Crop in action (Face-Mode)

Example 1

Original image
Original image
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with face crop
200x200 thumbnail with face crop

Example 2

Original image
Original image
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with face crop
200x200 thumbnail with face crop

Example 3

Original image
Original image
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with auto smart-crop mode
200x200 thumbnail with face crop
200x200 thumbnail with face crop

Examples of object-aware crop mode in action

Example 1

Original image
Original image
Thumbnail with object-aware smart cropping around a person (using fo-person)
Thumbnail with object-aware smart cropping around a person (using fo-person)
Thumbnail with object-aware smart cropping around a boat (using fo-boat)
Thumbnail with object-aware smart cropping around a boat (using fo-boat)

Example 2

Original image
Original image
Thumbnail with object-aware smart cropping around a refrigerator (using fo-refrigerator)
Thumbnail with object-aware smart cropping around a refrigerator (using fo-refrigerator)
Thumbnail with object-aware smart cropping around an oven (using fo-oven)
Thumbnail with object-aware smart cropping around an oven (using fo-oven)

Example 3

Original image
Original image
Thumbnail with object-aware smart cropping around a plant (using fo-pottedPlant)
Thumbnail with object-aware smart cropping around a plant (using fo-pottedPlant)
Thumbnail with object-aware smart cropping around a chair (using fo-chair)
Thumbnail with object-aware smart cropping around a chair (using fo-chair)

Best applications for this feature

Smart Crop will work well for any case where you need to create smaller images or thumbnails from a larger image, like creating user profile picture thumbnails from a larger profile picture using the face crop mode, or creating product image galleries where each image should have the product in the centre regardless of where it was in the original image.

Can I use the Smart Crop feature with other transforms

Of course, you can. You can combine smart cropping with any other transformation offered by ImageKit.

For example, you can combine smart cropping with responsive image tags to create a perfect responsive image experience across all devices for your users. You can also club it with a radius transform in a chain, to create rounded profile pictures of your users like this

Or, as shown below, you can combine object-aware cropping with the Layers transformations in ImageKit to create rich banners for your products in real time.

While we have tested the performance and results for a wide array of images, smart cropping may return inaccurate results for a small percentage of images. Smart cropping is a difficult problem to solve while keeping things near real-time. We are open to your feedback that will help us further improve the accuracy of the cropping algorithm. Please give it a try and do share your feedback in the comments below. Or write to us on developer@imagekit.io.

Like the idea? Want to try it out for yourself? You can try it for free!