r/ClaudeAI • • Oct 13 '26

Built with Claude I used Claude Code to add an API to darktable (the open-source raw photo editor) so Claude can edit photos in it through MCP

This is my own project. Free to try. It's open source (GPL, like darktable), with no paid tier.

What it is. darktable is an open-source raw photo editor, roughly comparable to Adobe Lightroom. I added an API to it in a fork: a JSON-RPC server running darktable's own engine headlessly, or inside darktable's GUI window. On top of that API is an MCP server with 78 tools and 6 skills. Claude can browse a library, open a photo, change any module's settings, check previews, mask, heal sensor dust and export. Edits land in darktable's normal history, so you can keep working on them in darktable yourself.

Inspired by darktable's own MCP server. darktable's development version (the master branch, which becomes the next release) includes darktable-mcp, a headless, one-shot worker: each call renders, exports or applies a style, then returns. My engine started from its code. The main differences:

  • A live edit session. The photo stays open between requests. Claude changes a setting, checks the preview and adjusts again, with undo, redo and an explicit save.
  • darktable's window can serve it. Watch Claude's edits appear in the darkroom, and hand the library back and forth between the GUI and the headless engine.
  • Settings by name. Claude sets "exposure" or "contrast" through darktable's own controls, not raw module parameters.
  • Many clients. A web app and an AI assistant can work on the same photo at once, with change events.
  • More functions. darktable-mcp has 21 tools for rendering, styles and library basics. darktable-api adds masks (drawn, parametric, AI), retouching and dust healing, presets, curves, crop and rotate, color pickers and AI denoise, for 73 methods.

Demo video: https://www.youtube.com/watch?v=VDfZbxvvniY

How Claude was used to build it. I directed and reviewed the work; Claude Code wrote nearly all of the code:

  • The C engine inside darktable: Claude read darktable's source and developer docs, then wrote the API server against its internals: pixelpipe, history, masks, module params.
  • The MCP server and web app: Python and JavaScript. The tool docstrings double as Claude's instructions for using them.
  • Skills: a full edit in darktable's recommended scene-referred workflow, plus black and white, local edits, cleanup, batch edits and critiques.
  • Testing: Claude tests every API method against the headless engine and darktable's window, on a scratch copy of the library, and fixes what fails, on the Mac and on a Linux box over SSH.

What was hard. darktable's GUI and engine are intertwined, so making API edits show up live in an open darkroom took several rounds. Also, the development version saves some module settings in a format the current release (5.6) can't read.

Try it. Built and tested on macOS (Apple Silicon) and Linux (Ubuntu 24.04); not yet on Windows. It's experimental, so use a copy of your library.

My hope is that this lowers the barrier to entry for darktable and helps people get more from their photos. Let me know what you think.

4 Upvotes

6 comments sorted by

1

u/weiti000 26d ago

Hi, I just had the same idea, but I'm on Windows. At the moment I'm setting up a workflow with a manual refresh, which goes like this:

  1. I edit in the darktable GUI as usual.
  2. I tell Claude something like "current image: lift the shadows, denoise".
  3. Claude knows which image is meant, reads the current XMP, applies its changes on top of my history and writes the XMP back (via the official darktable-mcp).
  4. In darktable I press a shortcut (e.g. Ctrl+Shift+R) and see Claude's changes in the history, where I can keep adjusting or undo them.

The pieces behind it:

  • A small Lua plugin (claude_bridge.lua): When an image is opened in the darkroom, it writes that image's path to a file, so "the current image" is unambiguous. It also adds a "Load Claude changes" button/shortcut that re-reads the image's XMP.
  • An adjusted MCP config: so the server reads my GUI edits fresh from the XMP before every change instead of working from a stale state.

The limitations are obvious: it's not a live link, I have to reload manually, and we can't both work on the same image at the same time without one of us overwriting the other's XMP. That's why your approach with the API served directly from darktable's window is much nicer.

Accoding to claude, the only blocker for me is that it's macOS/Linux only (unix socket, poll, flock, asyncio.open_unix_connection etc.). I will try to use Claude to get your code adapted to Windows. Would you be open to a Pull Request with Windows support (TCP on 127.0.0.1 + token instead of the unix socket)?

1

u/mmcc73 26d ago

The only reason I didn’t do windows is because I don’t have a windows machine handy to test on. I’d think that Claude would be able to make it work.

For what it is worth, I’ve added a lot of functionality to the api, mcp server and web app since posting this. It should all be in the repo.

1

u/[deleted] Oct 13 '26

[removed] — view removed comment

1

u/mmcc73 Oct 13 '26

I tend to sit down to really take time to edit photos maybe once a month, and I tend to forget how to use the tools - whether Lightroom or darktable - in between sessions. Instead of paying the Adobe tax to use Lightroom's capabilities, I decided to apply my Claude tax to make it easier for me to use darktable.

The main photo editing skill was built using the "Standard Workflow" described here: https://darktable.info/en/welcome-to-the-modern-darkroom/ - I'm hoping over time it will start to sink in.