SnapOtter 19a607454a fix: improve GPU detection diagnostics and fallback for container environments
The GPU detection in gpu.py had two issues preventing GPU usage in
containers (especially rootless podman with CDI):

1. When torch was installed but torch.cuda.is_available() returned
   False, the function returned immediately without trying the
   ONNX Runtime + nvidia-smi fallback. This meant a CPU-only torch
   build (installed before GPU was available) would block all GPU
   detection, even for ONNX-based tools.

2. The failure logged a generic "torch loaded but CUDA not available"
   with no diagnostic information, making it impossible to debug
   whether the issue was a CPU-only build, missing libraries, or
   device permissions.

The fix restructures gpu_available() into three detection tiers
(torch -> ONNX Runtime -> nvidia-smi) that always fall through on
failure. When torch CUDA fails, it now checks torch.version.cuda to
distinguish CPU-only builds from CUDA builds that can't access the
GPU, and logs LD_LIBRARY_PATH, torch.cuda.init() errors, and
nvidia-smi results.

Also fixes two env var passthrough bugs in buildMinimalEnv():
- SNAPOTTER_GPU was never passed to the Python subprocess, so the
  user-facing GPU override env var had no effect
- MODELS_DIR was a dead entry (never set as env var); replaced with
  MODELS_PATH which the Dockerfile sets and Python scripts read

Closes #134
2026-05-14 23:17:21 +08:00
2026-04-25 01:02:25 +08:00

SnapOtter - A Self Hosted Image Manipulator

Docker Hub GHCR CI License Stars Discord

SnapOtter - Dashboard

Key Features

  • 51 image tools - Resize, crop, compress, convert, watermark, color adjust, beautify screenshots, generate memes, vectorize, create GIFs, find duplicates, generate passport photos, and more. Supports 55+ input formats (including 23 camera RAW formats) and 14 output formats
  • Local AI - Remove backgrounds, upscale images, restore and colorize old photos, erase objects, blur faces, enhance faces, extract text (OCR). All on your hardware - no internet required
  • Pipelines - Chain tools into reusable workflows with unlimited steps. Batch process unlimited images at once
  • REST API - Every tool available via API with API key auth. Interactive docs at /api/docs
  • Single container - One docker run, no Redis, no Postgres, no external services
  • Multi-arch - Runs on AMD64 and ARM64 (Intel, Apple Silicon, Raspberry Pi)
  • Privacy first - Your images never leave your machine. SnapOtter asks once whether you'd like to share anonymous product analytics (which tools are used, errors encountered — never file data). Change anytime in Settings, or set ANALYTICS_ENABLED=false to disable completely

Quick Start

docker run -d --name snapotter -p 1349:1349 -v snapotter-data:/data snapotter/snapotter:latest
Have an NVIDIA GPU? Click here for GPU acceleration.

Add --gpus all for GPU-accelerated background removal, upscaling, and OCR:

docker run -d --name snapotter -p 1349:1349 --gpus all -v snapotter-data:/data snapotter/snapotter:latest

Requires an NVIDIA GPU and Container Toolkit. Falls back to CPU if no GPU is found. See Docker Tags for benchmarks and Docker Compose examples.

Default credentials:

Field Value
Username admin
Password admin

You will be asked to change your password on first login.

For Docker Compose, persistent storage, and other setup options, see the Getting Started Guide. For GPU acceleration and tag details, see Docker Tags.

Documentation

Feedback

Found a bug or have a feature idea? Open a GitHub Issue. We don't accept pull requests, but your feedback directly shapes the project. See CONTRIBUTING.md for details.

Join our Discord for help, discussion, and community updates.

License

This project is dual-licensed under the AGPLv3 and a commercial license.

  • AGPLv3 (free): You may use, modify, and distribute this software under the AGPLv3. If you run a modified version as a network service, you must make your source code available under the AGPLv3. This applies to personal use, open-source projects, and any use that complies with AGPLv3 terms.
  • Commercial license (paid): For use in proprietary software or SaaS products where AGPLv3 source-disclosure is not suitable, a commercial license is available. Contact us for pricing and terms.
Languages
TypeScript 91%
Python 3.5%
JavaScript 2.4%
Shell 1.6%
Astro 1.1%
Other 0.3%