Skip to content

Repository files navigation

Batonpass

A natural-language RAW photo editor you drive from your AI chat. Batonpass is the MCP (Model Context Protocol) layer of Latent Vision Studio — a model-agnostic, human-in-the-loop photo editing suite. Point Claude, Qwen, MSTY, or ChatGPT at one file, drag in a photo, and say what you want. It writes a real RawTherapee + ImageMagick recipe and renders an edited image — no presets, no LUTs, no full .arw 120 megabyte file round-trip for the edit itself.

Status: **first public release.** It works *today* for global edits. I can't test every camera or chase perfect colour on every body, so this is a "throw images at it and tell me what happened" release. Bugs, weird casts, and "this worked great for my kind of work" reports are all useful and appreciated!

Note

Experimental branch has different colour handling, wider camera compatibility and path hardening of MCP server at expense of slighly slower rendering. Feel free to use both, see which one you prefer!

This release ships as two connected tracks:

  • Batonpass for global edits.
  • Rifinire for masks.

They are deliberately joined through SEQ mode. The editor advances and pins the frame, and the mask path follows that same pin, so the edit and the mask do not drift apart by one RAW and ruin the whole point of sequential work.

What it does, in one breath

You talk, it edits. Exposure, contrast, white balance, shadows/highlights, per-colour HSL, clarity, dehaze, split-toning, Orton glow, and more. The model of your choice emits lines :

DSC\_1100 lift exposure, 5100K, shadows +15, vibrance +15, blacks -15

The back-end sees the result, and applies to the RAW file. The AI does not know or care it is editing RAW files - the histogram and settings are matched to the preview. in context** — refining the look conversationally. It can also build generative masks , if you choose, for selective work down the track in that same prompt.

It also includes the XMP sidecar: Photoshop can read the XMP, and you continue from there instead of treating the PNG like a dead end - letting you add the finer touches!

---

Why an AI-driven editor?

The bottleneck today in editing isn't the sliders — it's deciding what to do. An LLM at frontier or near-frontier can do full reasoning to "make this look like an overcast editorial portrait" and translating that into concrete adjustments with to that specific photograph.

Batonpass does the translation deterministically: the AI proposes intent, a plain-Python compiler turns it into a clamped, camera-aware recipe, and the actual pixels are rendered by RawTherapee/ImageMagick locally. The AI never touches your pixels directly.

---

Quick start

You need: Python , RawTherapee (rawtherapee-cli), and ImageMagick. exiftool is optional but STRONGLY recommended (better WB + XMP sidecars).

pip install fastmcp
# put your RAWs in ./raws and preview JPEGs in ./select
python photoedit.py --check-deps          # confirm the tools are found (but actually just let AI on the other fail and figure)
python photoedit.py "DSC_EXAMPLE1234 5300K green_tint +8 ev +0.4 contrast +35 highlights -35 shadows +20 blacks -2.0 saturation +16 hsl_green_sat +20 hsl_yellow_sat +15 hsl_orange_lum +6 hsl_blue_sat +18 clarity +28 wavelet_medium +14 softglow 10 softglow_radius 15 softglow_bright 125 sigmoid_contrast 3.5" --KI

That's the CLI. The fun part is wiring it into your AI client as an MCP server — see below.

---

Using it from your AI client

Batonpass ships as one MCP tool: process\_photo(prompt). Exact parameters differs a little per client and can change on their end any time, but all work on free tiers:

Claude Desktop (the smoothest)

Add photo\_server.py as an MCP server. Then add a control document (see repo for samples, VERY rough atm):

  1. Drag an image into the chat and say e.g. "edit this: warmer, lift shadows, punchy but keep highlights."
  2. It edits and shows you the result.
  3. Drop the edited file + the next image — it understands the previous look and improves in context.

Claude reads the dragged image, so it just works.

MSTY / Qwen (local, via Ollama-style setups)

Same tool, one wrinkle: local models often can't see the filename of what you dragged. Either:

  • tell it the stem: "DSC_1100", or
  • use SEQ modeSEQ instead of a filename and it grabs the next un-edited RAW from ./raws automatically (great for working through a shoot).
  • a System Prompt that you can append to desktop clients + sample coversation, which provides guidance on how to edit a type of photography - eg fashion shoot.

ChatGPT (remote only)

Works on free tier, but ChatGPT MCP needs Developer Mode enabled on the account and the server exposed over SSE (photo\_remotemcp.py wraps that with ngrok). Upside: ChatGPT can see the filename, so it feels the most "it just knows what I mean."

NOTE! Remote MCP is not enabled for mask generation to keep your API token safe!

---

What it does NOT do

  • No generative edits, no LUTs, no film simulations, no tone-mapping.
  • No batch engine, no grain/vignette/lens/denoise correction.
  • It edits one image at a time, on purpose, with you in the loop.

This is a feature: every edit is an explicit, reviewable RawTherapee PP3 and XMP you could open and tweak by hand.

---

How it works (no diagram, just the chain)

your AI client
   │  process\_photo("DSC\_1100 warm 5600K vibrance +15")
   ▼
photo\_server.py   (MCP server: stdio or SSE)
   │  parse prompt → resolve RAW + preview → compile recipe → write PP3 (pure python, fast)
   │  returns immediately ("command\_landed")
   ▼
batonpass\_runner.py   (detached progress window)
   │  rawtherapee-cli  (RAW → 16-bit TIFF)
   │  ImageMagick      (TIFF → PNG + JPEG preview, optional Orton glow)
   ▼
edits/DSC\_1100\_edited.png  +  edits/output/DSC\_1100\_edited.jpg  (+ .xmp sidecar in raw folder)

The brain is photoedit.py: ~200 natural-language aliases → a clamped, camera-aware recipe. The server returns fast and a small window shows the render progressing, so your chat never blocks.

Included is the all-important ArchMap_MCP_.md : a full architectural guide to allow easy agentic-driven editing, forking or color formulation adjustment!

---

Folder layout

your-working-dir/
├── raws/            # drop your RAWs here (NEF/ARW/DNG/CR2/CR3/RAF/…)
├── select/          # Preview JPEGs the AI reasons from
├── edits/           # outputs land here (PNG + JPEG preview + recipes/)
├── masks/           # generative masks land here (optional)
└── runware.key      # only needed if you use masks (gitignored!)

The generator is currently set to Klein 4B but if it picks up steam, popular generator that work well for masking would be added. Still requires testing.

---

Masks (optional — Rifinire)

Batonpass can also generate AI masks for selective editing (isolate a garment, the sky, skin, etc.) via the Runware FLUX.2 [klein] 4B model. This is wired up but still in heavy testing and not part of this release's focus — you'd only use it if you have a Runware API key and a small budget to spend. For reference it's about $0.0006 per mask image on Klein 4B, so it's cheap, but it's opt-in. Most people should ignore masks for now and just use the editor.

---

Supported cameras

Whatever RawTherapee can demosaic, Batonpass can render — that's a long list (Nikon, Sony, Canon, Fuji, Panasonic, Pentax, DNG, etc.). White-balance handling is tuned per-format (NEF/NRW, ARW, DNG) and falls back gracefully. This is exactly where I need field reports: I can't own every toy (rly wishing I could), so if your camera produces a weird cast or a wrong WB, tell me the make/model and I'll look.

---

Known edges

  • Colour/WB is good, not perfect, and varies by camera. Reports welcome.
  • Local models need the filename or SEQ (see above).
  • ChatGPT needs Developer Mode + remote SSE.
  • Actually using the masks is soon-to-be-release.

---

Contributing / reporting

Open an issue with: camera model, the prompt you used, what you expected vs got, and the output if you can. "These edits / these masks worked great for my kind of photography (I never shoot underwater/astro/whatever)" is extremely valuable — it tells me where the defaults hold and where they don't. I'm active and reachable here.

---

Where this fits

Batonpass is one stage of Latent Vision Studio (LVS) — a model-agnostic, end-to-end photo workflow that keeps a human in creative control at every step:

Stage Agentic MCP
Ingest SDHopper / Batchline (released)
Culling assist Aesthetic-Darwinism (released)
Global edit As-You-See-Fit (released) Batonpass (released)
Mask builder Sperpero (released) Rifinire (released)
Mask gallery Eidolon (released)
Final mask application Sprezzatura (released) Linea Maestra
Mystery module Needs Mythos-class model (Very Unreleased)

LVS Passive (the Gemini web archiver companion) is a separate, optional helper — not part of this pipeline.

---

License

GNU Affero General Public License v3.0 (AGPL-3.0).

About

Batonpass: A natural-language RAW photo editor driven from your AI chat (MCP layer for Latent Vision Studio)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages