Offline batch watermark remover, built on an M1 MacBook. No subscription, no credits, no uploading photos to a browser one at a time.

I had a folder of watermarked photos to clean up for a project. I wasn't paying €25 a month for a tool I'd use twice.

I tried the usual options first:

  1. "Free" web removers. Upload one photo, wait twenty seconds, then find out the HD download needs an account and 15 monthly credits.
  2. Desktop trial apps. Download a 400MB.dmg that looks like it was compiled in 2014. Run a photo through it. Watch it stamp its own, bigger watermark over the original.
  3. Free cloud GPU Spaces. Worked well for four photos. Then Hugging Face cut me off for hitting the daily ZeroGPU limit.

Running it locally was the obvious answer. The catch was doing it on an M1 with 16GB of unified memory. No NVIDIA GPU, no CUDA, and a PyTorch MPS backend that quietly falls back to CPU the moment it sees an FFT.

So I built a CLI that runs offline on Apple Silicon, works through whole folders, and costs nothing. CUDA and plain CPU work too.

Plugging open-source segmentation models into LaMa gets you most of the way in an afternoon. The last 20% is where local removal usually falls over:

  • Small letters left behind. A standard 512px pass takes out big logos and banners, then leaves twenty little repeating letters scattered across the sky.
  • Real things getting erased. The aggressive specialist models (lines ,repeated ,logo ) and 256px tiles both catch smaller marks. They also remove Heras fencing, crane cables and red"DANGER KEEP OUT" signs, because a zoomed-in tile has no idea what the rest of the photo looks like.
  • Grass in the sky. Givebig-lama a full 1300px+ photo in one go and its global FFT convolutions pull texture from the bottom of the frame and paint a patch of grass into clear sky.

The fix was to stop putting everything into one noisy mask and split the jobs up:

  1. Primary scan at global and 512px. Uses theuniversal and gatedoverlay UNet++ models fromchristophernavas/watermark-remover . Fences, cables and safety signs survive. Photos that are already clean come out untouched (0.0% mask).
  2. 256px seed scan, then repeating-glyph and 2D lattice recovery. The 256px pass never writes to the final mask. It only collects candidates. When enough of them match each other in high-pass luminance, the engine averages them into a clean template, fits the repeating grid (rectangular, staggered or diagonal, nothing hardcoded to a particular agency) and goes back for the marks it missed: faint ones, ones behind objects and ones cut off at the edge.
  3. Local-crop LaMa inpainting (big-lama.pt). Each mask cluster gets inpainted in its own tight crop, feathered outward only. If LaMa is painting sky, it only sees sky. Solid dark stock-photo footer bars are handled separately so they don't smear black into the foreground. Use--crop-footer to cut them off completely.

It all runs locally on MPS (PYTORCH_ENABLE_MPS_FALLBACK=1 is set for you). Weights download once into ~/.cache/huggingface/hub and ~/.cache/unwatermark/big-lama.pt. After that it's fully offline. On an M1 it takes about 6 to 10 seconds an image.

Needs Python 3.12+ and uv.

uv tool install git+https://github.com/otterolie/unwatermark.git

Or run it without installing:

uvx --from git+https://github.com/otterolie/unwatermark.git unwatermark ./photos -r --format original
git clone https://github.com/otterolie/unwatermark.git
cd unwatermark

# Optional: put the launcher on your PATH
mkdir -p ~/.local/bin
ln -sf "$(pwd)/unwatermark" ~/.local/bin/unwatermark

# Optional: get the weights now instead of on first run
unwatermark --download-models

Run it from inside any folder of images:

# Clean everything recursively, keep original formats (writes to <folder>_cleaned/)
unwatermark . -r --format original

# Same, and crop off solid black footer bars
unwatermark . -r --format original --crop-footer

# Reprocess and overwrite files already in the output folder
unwatermark . -r --format original --overwrite

# Clean specific files into a custom folder, and save the masks to see what it found
unwatermark photo1.jpg photo2.png -o ./cleaned --save-masks

| Flag | Default | Purpose | |---|---|---| | -r, --recursive | off | Walk subfolders and mirror the folder structure in the output | | -o, --out DIR | <input>_cleaned | Output folder | | --format | png | original ,png ,jpg orwebp | | --overwrite | off | Reprocess files already in the output. Skipped by default, so an interrupted batch picks up where it stopped | | --crop-footer | off | Crop off solid dark stock-photo footer bars | | --threshold | 0.48 | Detection threshold. 0.35 to0.42 catches fainter marks,0.50+ is stricter | | --expand /--feather | 4 /2 | Mask dilation and outward-only edge feathering, in pixels | | --passes | 1 | Cleanup passes. 1 is usually enough with lattice recovery on | | --local-models | full | full (universal,overlay ),fast (universal ),aggressive ,all , or comma-separated model keys | | --no-repeat-propagation | off | Turn off repeating-glyph and 2D lattice recovery | | --save-masks | off | Write <name>_mask.png next to each output | | --json | off | Print a JSON summary to stdout. Progress logs go to stderr | | --device | auto | auto (MPS, CUDA, then CPU),mps ,cuda orcpu |

Use --json when calling it from a script or an agent, so stdout is clean JSON:

unwatermark ./photos -r --format original --crop-footer --json

Or import the engine in Python:

from PIL import Image
from local_engine import LocalWatermarkRemover

remover = LocalWatermarkRemover(model_spec="full", device="auto")
res = remover.remove_watermarks(Image.open("input.jpg"), crop_footer=True)
res.image.save("cleaned.jpg", quality=95)
print(f"detected={res.had_detection} mask={res.coverage_pct:.1f}%")

Exit codes, the JSON schema and architecture notes are in AGENTS.md.

Local mode is the default, and it's what I use. The remote Hugging Face Space presets from earlier experiments are still there if you want a generative edit pass. These upload your images, so don't use them on anything you can't share.

unwatermark --list-presets

| Preset | Backend | Notes | |---|---|---| | local(default) | Offline UNet++ + big-lama.pt | Multi-scale scan, 2D lattice recovery, local-crop LaMa. No uploads, no quotas | | local-mask | Offline big-lama.pt | Local LaMa inpainting with your own --mask mask.png | | qwen | Qwen/Qwen-Image-Edit (HF ZeroGPU) | Remote generative fallback. Set HF_TOKEN for a bigger daily quota | | auto | nimeshakalanka24/watermark-remover | Remote HF Space, CPU | | zip-batch | Faraztbt/watermark-remover | Remote HF Space, batch ZIP | | mask | xTHExBEASTx/watermark-remover | Remote HF Space, mask-based |

Built by otterolie.

原文来源:github.com