Skip to content

card-crop 1.0.0 - straighten and crop scanned ID-1 cards in GIMP

Choose a tag to compare

@lpgonzalez lpgonzalez released this 18 Jul 08:58

card-crop 1.0.0

A GIMP 3 plug-in that detects, straightens and crops scanned ID-1 cards
(credit cards, ID cards, loyalty cards, transit passes: anything ID-1 shaped).
Point it at a scan, and it finds the card even when it sits at an angle,
straightens it, crops to ISO/IEC 7810 ID-1 proportions with correctly rounded
corners, and leaves the background transparent.

Install

Download card-crop-1.0.0.zip (or .tar.gz) below, unpack it, and copy the
card-crop/ folder into your GIMP plug-ins directory:

Linux    ~/.config/GIMP/3.0/plug-ins/
Windows  %APPDATA%\GIMP\3.0\plug-ins\
macOS    ~/Library/Application Support/GIMP/3.0/plug-ins/

On Linux and macOS, make it executable: chmod +x card-crop/card-crop.py.
Restart GIMP; the commands appear under Filters > Card Tools. Full steps
are in the bundled INSTALL.txt.

Requires GIMP 3.0 or later. No other dependencies: no NumPy, no OpenCV. GIMP's
bundled Python is all it needs.

What it does

  • Crop card (auto) detects the card inside your selection (or the whole
    image), straightens it, and crops it.
  • Crop card from path is the fallback for hard cases: mark the four corners
    by hand and it does the rest.

Detection runs four candidates (brightness and colour, each with two
thresholds) and picks the one that is actually card-shaped, so it copes with
cases that defeat a single method, like a grey card with a coloured band. The
corner radius is measured from the card, not assumed. Failures are explained,
never silent, and success is reported quietly on the status bar.

Languages

The interface is available in English, Spanish, Catalan, Galician, French,
Italian, Brazilian Portuguese, German and Dutch. The non-English catalogues are
machine-drafted and unreviewed; corrections are welcome via an issue.

Notes

This is the first release. It has been tested on real scans and synthetic
cases, always erring toward cropping slightly inward rather than leaving
background behind. If a scan trips it up, opening an issue with the DEBUG log
(create a file named DEBUG next to card-crop.py) is the most useful thing
you can send.