Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsApr 24, 2026·3 min de lecture

Thumbor — Smart Image Cropping and Processing Server

Thumbor is an open-source HTTP image server that performs on-demand cropping, resizing, and filtering with smart detection of important image regions, making it ideal for serving optimized images at scale.

assetLangBanner.body

Introduction

Thumbor is a smart on-demand image server written in Python. It detects faces and important regions within images, then crops and resizes them intelligently so the most relevant content is preserved. Web applications use it as a CDN-origin or image proxy to serve perfectly sized assets without pre-generating every variant.

What Thumbor Does

  • Performs on-demand resize, crop, flip, and format conversion via URL parameters
  • Uses face and feature detection to crop images around the most relevant area
  • Applies filters such as blur, watermark, sharpen, brightness, and format conversion
  • Supports pluggable storage backends including file system, S3, and Redis
  • Provides HMAC-based URL signing to prevent abuse of the processing endpoint

Architecture Overview

Thumbor runs as a Tornado-based async HTTP server. When a request arrives, the URL is parsed to extract transformation parameters. The original image is fetched from a configurable loader (HTTP, S3, or filesystem), passed through the detection pipeline for smart cropping, processed by the filter chain, and then stored in a result cache. OpenCV powers the smart-detection algorithms. The server is stateless and horizontally scalable behind a load balancer.

Self-Hosting & Configuration

  • Install via pip or use the official Docker image for containerized deployments
  • Generate a starter config with thumbor-config and customize storage, caching, and detection settings
  • Set SECURITY_KEY in the config to enable HMAC URL signing and prevent open-proxy abuse
  • Configure result storage (filesystem, S3, or Redis) to cache processed images and reduce CPU load
  • Place Thumbor behind Nginx or a CDN for TLS termination and edge caching

Key Features

  • Smart cropping powered by OpenCV face and feature detection
  • URL-based API where image transformations are encoded directly in the request path
  • Pluggable architecture for loaders, storage, result storage, and detectors
  • Built-in filter pipeline with over 20 available filters
  • HMAC URL signing for security without requiring authentication middleware

Comparison with Similar Tools

  • imgproxy — Go-based image proxy focused on speed and security, less smart-detection capability
  • Imaginary — Lightweight Go image processing server, fewer detection features but simpler to run
  • Cloudinary — SaaS image CDN with similar transformations, not self-hosted
  • Sharp (libvips) — Node.js library for image processing, not a standalone server

FAQ

Q: How does smart cropping work? A: Thumbor uses OpenCV to detect faces and points of interest, then adjusts the crop region to keep detected areas visible when resizing to the target dimensions.

Q: Can I use Thumbor without URL signing? A: Yes, using the /unsafe/ URL prefix, but this is only recommended for development. In production, enable HMAC signing to prevent abuse.

Q: What image formats are supported? A: JPEG, PNG, GIF, WebP, and AVIF. Format conversion can be requested via the filters parameter or Accept header negotiation.

Q: How do I scale Thumbor for high traffic? A: Run multiple Thumbor instances behind a load balancer with a shared result storage backend like S3 or Redis. Each instance is stateless.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires