← all repositories
esimov/caire

Resizing that knows what's in the picture

Caire implements seam carving in Go, so images shrink and grow by deleting boring pixels instead of squashing everything equally.

★10.8k stars Go Computer Vision
caire
Velocity · 7d
+12
★ / day
Trend
↘cooling
star history

What it does

Caire resizes images content-aware: it builds an energy map via edge detection, then repeatedly removes (or inserts) the lowest-energy vertical or horizontal seams using dynamic programming. The result is a narrower or shorter image that keeps the interesting stuff — faces, buildings, boats — while quietly disposing of sky, water, and other low-detail filler. It works both directions: shrinking and enlarging.

The interesting bit

The face detection is the nice touch. Using the embedded Pigo detector, Caire marks face regions as high-energy so seams route around them — the README’s before/after shots show faces surviving intact where the naive carve mangles them. There’s also a two-stage strategy for aspect-ratio changes: it rescales conventionally first, then seam-carves only the leftover pixels.

Key highlights

  • Protective (-mask) and removal (-rmask) masks to force seams toward or away from regions
  • Pipes via stdin/stdout, accepts image URLs directly, and processes directories recursively and concurrently
  • Tunable Sobel threshold and blur radius for edge-detection quality
  • GUI preview window (Gio-based) shows carving in real time; debug mode draws the seams
  • Ships as a Go library as well as a CLI; OpenFaaS and snap integrations exist

Caveats

  • The GUI preview is on by default, which is surprising for a CLI tool — and it needs Gio’s platform dependencies installed
  • Masks must be binary and exactly the same size as the input image, which is fiddly
  • No performance numbers in the README, so expect seam carving’s usual cost on large images

Verdict

Anyone who needs to reformat photos for varying layouts — thumbnails, banners, responsive crops — without cropping out subjects should try this. If you just need fast mechanical scaling, a standard resizer is cheaper and faster.

Frequently asked

What is esimov/caire?
Caire implements seam carving in Go, so images shrink and grow by deleting boring pixels instead of squashing everything equally.
Is caire open source?
Yes — esimov/caire is open source, released under the MIT license.
What language is caire written in?
esimov/caire is primarily written in Go.
How popular is caire?
esimov/caire has 10.8k stars on GitHub and is currently cooling off.
Where can I find caire?
esimov/caire is on GitHub at https://github.com/esimov/caire.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.