Skip to content

AI-Powered Cropping

Intelligent cropping algorithms that automatically focus on the most important parts of your images using artificial intelligence and computer vision techniques.

Crop Modes

crop=faces

AI-powered face detection automatically centres the crop area on detected human faces when used with fit=crop.

Use Cases: - Profile pictures and avatars - Social media images
- Portrait photography - Team member photos

Example:

image.jpg?w=300&h=300&fit=crop&crop=faces

crop=objects

Object detection AI identifies and focuses on the main subject/object when used with fit=crop.

Use Cases: - Product photography - E-commerce listings - Marketing materials - Catalog images

Example:

product.jpg?w=400&h=400&fit=crop&crop=objects

crop=attention

Uses visual attention algorithms to identify areas that naturally draw the human eye.

Use Cases: - General purpose smart cropping - Social media content - Hero images - Thumbnail generation

Example:

image.jpg?w=800&h=600&fit=crop&crop=attention

crop=entropy

Focuses on areas with the highest visual complexity and detail, preserving the most information-rich parts of the image.

Use Cases: - Technical documentation - Detailed imagery - Scientific photography - Architecture photography

Example:

image.jpg?w=500&h=400&fit=crop&crop=entropy

crop=edges

Edge detection algorithms identify and preserve sharp lines, boundaries, and structural elements in the image.

Use Cases: - Architecture photography - Technical drawings
- Geometric artwork - Industrial photography

Example:

building.jpg?w=600&h=400&fit=crop&crop=edges

fit=facearea

Dedicated face-area fit mode that applies face-aware cropping directly.

Example:

image.jpg?w=300&h=300&fit=facearea

How AI Cropping Works

  1. Analysis: AI algorithms analyze the entire image to identify important features
  2. Selection: Depending on crop mode, the optimiser selects either a smartcrop strategy or an AI-detected region
  3. Optimization: The crop area is positioned to maximize the score while fitting the requested dimensions
  4. Fallback: If AI detections are unavailable, crop behavior falls back to deterministic defaults

Best Practices

Face Detection Cropping

  • Works best with clear, well-lit portraits
  • crop=faces and fit=facearea both center around detected faces
  • If no faces are detected, the crop falls back to top-left gravity

Object Detection Cropping

  • Optimized for a single primary subject
  • Works well with products, animals, vehicles
  • Best results with clear subject-background separation
  • When multiple objects are detected, the highest-confidence object is used as the focal point

Attention-Based Cropping

  • Mimics human visual attention patterns
  • Considers color contrast, complexity, and patterns
  • Good general-purpose option when specific features aren't known
  • Balances multiple visual elements

Entropy Cropping

  • Preserves maximum visual information
  • Excellent for images with fine details
  • May not always be aesthetically optimal
  • Best for technical or documentary purposes

Edge Detection Cropping

  • Preserves structural and geometric elements
  • Excellent for architectural photography
  • Works well with high-contrast images
  • May not work well with soft, organic subjects

Performance Considerations

  • AI cropping adds minimal processing time (~50-200ms)
  • Results are cached globally for subsequent requests
  • Face detection is fastest, object detection takes slightly longer
  • Attention and entropy analysis are moderately complex
  • Edge detection is computationally lightweight

Combining with Other Parameters

Smart Cropping with Enhancement

portrait.jpg?w=400&h=400&fit=crop&crop=faces&brightness=10&contrast=15

Product Focus with Padding

product.jpg?w=500&h=500&fit=crop&crop=objects&pad=20&bg=white

Attention Cropping with Effects

landscape.jpg?w=800&h=600&fit=crop&crop=attention&saturation=15&contrast=20

Fallback Behavior

When AI algorithms cannot detect suitable features: 1. fit=crop&crop=faces: If face detection runs but finds nothing, falls back to top-left crop coordinates. 2. fit=crop&crop=objects: If object detection runs but finds nothing, falls back to top-left crop coordinates. 3. fit=crop&crop=faces,objects: Faces are attempted first, then objects; when detection runs but nothing is found, fallback is top-left. 4. fit=facearea: If face detection is disabled, this fit mode errors and must rely on fit sequencing (for example fit=facearea,crop) for fallback behavior.

Mode Priority and Combinations

  • crop=faces,objects is supported, but faces is attempted first.
  • objects is a crop mode, not a fit mode.
  • If neither faces nor objects can run (for example, related feature flags are disabled), crop processing falls back to non-AI smartcrop behavior.

Examples by Use Case

Social Media Profiles

profile.jpg?w=400&h=400&fit=crop&crop=faces&brightness=5&contrast=10

E-commerce Products

product.jpg?w=500&h=500&fit=crop&crop=objects&pad=30&bg=white&q=85

Blog Post Thumbnails

article.jpg?w=300&h=200&fit=crop&crop=attention&saturation=10

Architecture Photography

building.jpg?w=800&h=600&fit=crop&crop=edges&contrast=20&sharp=15

Detailed Documentation

diagram.jpg?w=600&h=400&fit=crop&crop=entropy&q=95&fm=png

AI-powered cropping ensures your images are automatically optimized for their intended use, saving time while delivering professional results.