← Resources

Website

Scry Magic: Magic: The Gathering card scanner in the browser

Scry Magic is a free, local-first web app for Magic: The Gathering players. You upload photos or videos of your cards, and it identifies them; then you can organize a collection, build and analyze decks, and track prices. Card recognition runs entirely in the browser, in a Web Worker. Photos never leave the device; the site only sends card IDs to Scryfall to fetch card data.

How the scanner works

  1. Card detection. A YOLO11 pose model, fine-tuned for this project and exported to ONNX, runs with ONNX Runtime Web (WebAssembly). The image is letterboxed to 640×640. The model returns a bounding box and the four corner keypoints of each card.
  2. Perspective correction. A homography computed from the four corners flattens each card into a front-facing crop, even when the photo was taken at an angle.
  3. Feature extraction. OpenCV 4.12, compiled to WebAssembly, extracts RootSIFT local descriptors. These hold up well under the blur, glare and lighting changes typical of phone photos.
  4. Large-scale retrieval. The descriptors are matched against an IVF-PQ index (inverted file with product quantization). It holds 88,873 base cards plus a supplement of recent artwork, currently 3,820 card faces. Product quantization keeps the index compact enough to run in a browser tab.
  5. Geometric verification. RANSAC checks that the matched keypoints fit a consistent geometric transform on both the artwork and the card frame. A candidate is accepted only with enough inliers. Cards that look alike but come from different printings are flagged for the user to confirm.

Keeping the model current without retraining. A daily GitHub Action finds new artwork on Scryfall, including preview cards from upcoming sets. It computes their features and appends them to the supplement index while the existing index stays unchanged. It then checks every file’s checksum and publishes the update. New cards become scannable within a day, without retraining the detector.