backdraw 0.0.0-stage → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +635 -2
  3. package/README.tr.md +653 -0
  4. package/bin/backdraw.js +60 -0
  5. package/cli.js +105 -0
  6. package/doctor.js +174 -0
  7. package/extension/_locales/en/messages.json +3 -0
  8. package/extension/_locales/tr/messages.json +3 -0
  9. package/extension/aspect.js +25 -0
  10. package/extension/background.js +1015 -0
  11. package/extension/collection.html +45 -0
  12. package/extension/collection.js +62 -0
  13. package/extension/collections.js +409 -0
  14. package/extension/i18n.js +359 -0
  15. package/extension/icons/icon128.png +0 -0
  16. package/extension/icons/icon16.png +0 -0
  17. package/extension/icons/icon32.png +0 -0
  18. package/extension/icons/icon48.png +0 -0
  19. package/extension/icons/mascot-192.png +0 -0
  20. package/extension/icons/mascot-96.png +0 -0
  21. package/extension/inpage.js +624 -0
  22. package/extension/manifest.json +20 -0
  23. package/extension/menus.js +50 -0
  24. package/extension/popup.css +90 -0
  25. package/extension/popup.html +63 -0
  26. package/extension/popup.js +376 -0
  27. package/extension/settings.js +35 -0
  28. package/extension/setup.js +57 -0
  29. package/extension/sidepanel.css +113 -0
  30. package/extension/sidepanel.html +31 -0
  31. package/extension/sidepanel.js +433 -0
  32. package/extension/theme.css +22 -0
  33. package/host.js +664 -0
  34. package/identity.js +21 -0
  35. package/install.js +427 -0
  36. package/lib/args.js +30 -0
  37. package/lib/aspect.js +85 -0
  38. package/lib/browsers.js +74 -0
  39. package/lib/collection-store.js +288 -0
  40. package/lib/collections.js +192 -0
  41. package/lib/doctor.js +143 -0
  42. package/lib/extension-calls.js +59 -0
  43. package/lib/gallery.js +63 -0
  44. package/lib/limits.js +18 -0
  45. package/lib/mcp-clients.js +178 -0
  46. package/lib/naming.js +25 -0
  47. package/lib/png.js +24 -0
  48. package/lib/projects.js +56 -0
  49. package/lib/prompt.js +25 -0
  50. package/lib/protocol.js +50 -0
  51. package/lib/results.js +170 -0
  52. package/lib/term.js +22 -0
  53. package/lib/toml.js +248 -0
  54. package/mcp-server.js +437 -0
  55. package/package.json +52 -4
  56. package/platform/index.js +14 -0
  57. package/platform/win32.js +268 -0
  58. package/setup.js +213 -0
  59. package/shared.js +118 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 devtalh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,636 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="branding/banner/backdraw-banner.png" alt="Backdraw" width="100%">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <p align="center">
6
+ <b>Let Claude generate images with your own ChatGPT account, in a background Chrome tab.<br>No API key, no extra cost, nothing to watch.</b>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/backdraw"><img src="https://img.shields.io/npm/v/backdraw" alt="npm version"></a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <img src="branding/demo/backdraw-demo.gif" alt="Right-click images on the web to save them as references, then Claude Code asks Backdraw for an image in that style; ChatGPT draws it in a background tab and the file is saved on the PC" width="100%">
15
+ </p>
16
+
17
+ <p align="center"><a href="README.tr.md">Türkçe</a></p>
18
+
19
+ ---
20
+
21
+ ## What it does
22
+
23
+ Backdraw is a local MCP server plus a Chrome extension. Ask Claude for an image "with ChatGPT" and
24
+ Backdraw opens ChatGPT in a background tab of your own Chrome, where you are already signed in. It
25
+ sends the prompt, waits for the picture and saves it on your PC. Claude gets the file path, a preview
26
+ and the link to the chat.
27
+
28
+ - Generate new images, or edit one by attaching it as a reference.
29
+ - Ask for a shape (`16:9`, a `4:1` banner, …) or a transparent background.
30
+ - Save reference images from any website with a right-click and reuse them as collections.
31
+ - Browse everything you made in a gallery side panel.
32
+ - Pure Node.js with zero npm dependencies. Everything runs on your computer.
33
+
34
+ > **Personal use, with your own ChatGPT account and at your own risk.** Automating the ChatGPT web
35
+ > page may conflict with OpenAI's terms; read
36
+ > [Disclaimer and responsible use](#disclaimer-and-responsible-use) before you start.
37
+
38
+ ## Why Backdraw?
39
+
40
+ - **Your everyday Chrome.** No separate browser profile, no second login, no automation browser:
41
+ Backdraw works in the Chrome you already use, where you are signed in to ChatGPT.
42
+ - **Out of your way.** The work happens in a muted background tab that never takes focus, so you
43
+ keep working while the image is made.
44
+ - **No open ports.** The pieces talk over Chrome native messaging and a named pipe that only your
45
+ Windows user can open. There is no DevTools port (such as 9222) and no local web server.
46
+ - **No API key.** It uses your ChatGPT plan; each image counts toward your normal ChatGPT limits.
47
+ - **References from the web.** Right-click images on any site to collect them, then generate in
48
+ their style.
49
+ - **A gallery** of everything you made, in Chrome's side panel.
50
+ - **One command to set up:** `npx backdraw@latest setup`. Loading the extension is the only step
51
+ left to you.
52
+
53
+ ### How it compares
54
+
55
+ Other open-source projects take different approaches, and several of them do things Backdraw
56
+ doesn't (macOS or Linux support, an API mode, running on a server). Each row was checked against
57
+ the project's README and source on 2026-10-25; **?** means we couldn't tell. Spotted a mistake?
58
+ Please [open an issue](../../issues).
59
+
60
+ | Project | Uses your everyday Chrome (no separate profile or login) | Background tab (doesn't take focus) | Open port | API key needed | Right-click reference collections | Gallery | Platforms |
61
+ |---|---|---|---|---|---|---|---|
62
+ | **Backdraw** | Yes | Yes | No (native messaging + named pipe) | No | Yes | Yes | Windows |
63
+ | [lownamlee/gpt-image-2-mcp](https://github.com/lownamlee/gpt-image-2-mcp) | No (own browser profile) | Partly¹ | No | Optional (API mode) | No | No | ? |
64
+ | [nothariharan/image-gen](https://github.com/nothariharan/image-gen) | No (own Edge profile) | No | Yes (CDP 9222) | No | No | No | Windows; macOS/Linux by hand |
65
+ | [goofyshwetank/mcp-chatgpt-gemini-image](https://github.com/goofyshwetank/mcp-chatgpt-gemini-image) | No (own Chromium profile) | No | No | No | No | No | ? |
66
+ | [Dasemu/chatgpt-imagegen-mcp](https://github.com/Dasemu/chatgpt-imagegen-mcp) | No (own profile, on a server) | Partly² | Yes (HTTP 8088, remote server) | No (own server token) | No | No | Linux server |
67
+ | [Codex built-in `$imagegen`](https://learn.chatgpt.com/codex/image-generation) | – (no browser) | – | No | No (Codex sign-in) | No | ? | ? |
68
+ | [Sateezg/codex-bridge](https://github.com/Sateezg/codex-bridge) | – (no browser, runs Codex) | – | No | No (Codex sign-in) | No | No | macOS, Linux |
69
+
70
+ ¹ Its own browser window, moved off screen or minimized once ChatGPT is ready.
71
+ ² A browser on a virtual display (Xvfb) on the server, or headless.
72
+
73
+ Codex users already have built-in image generation; Backdraw is mainly for Claude Code, the
74
+ Claude desktop app and VS Code.
75
+
76
+ ## How it works
77
+
78
+ ```
79
+ Claude Code / Claude desktop app (MCP client)
80
+ │ MCP over stdio
81
+ ▼
82
+ mcp-server.js ──── named pipe, your Windows user only ────► host.js
83
+ │ Chrome native messaging
84
+ ▼
85
+ Backdraw Chrome extension
86
+ │ background tab
87
+ ▼
88
+ chatgpt.com → your Project → new chat → image
89
+ ```
90
+
91
+ - `mcp-server.js` is what Claude talks to. It forwards every tool call to `host.js`.
92
+ - `host.js` is started by Chrome when the extension connects. It runs the job queue (one job at a
93
+ time), saves the images and keeps the job history in `%USERPROFILE%\.backdraw\data`.
94
+ - The extension opens chatgpt.com in a **background tab**, inside the ChatGPT Project you selected.
95
+ The tab is never activated and is muted, no window takes focus, and your mouse and keyboard are
96
+ never used: only synthetic events inside that one tab. The tab closes when the job is done, unless
97
+ you are looking at it.
98
+ - **No API key.** Backdraw uses the ChatGPT session you already have in Chrome. It never reads
99
+ cookies, tokens or passwords.
100
+ - **Nothing leaves your PC except what you send to ChatGPT** (the prompt and any reference images).
101
+ There is no Backdraw server and no telemetry.
102
+
103
+ Images are saved in your Pictures folder under `Backdraw`, named after the time and the prompt, e.g.
104
+ `20261021-153012_a-cozy-reading-nook.png`.
105
+
106
+ ## Requirements
107
+
108
+ | | |
109
+ |---|---|
110
+ | OS | Windows 10 or 11 |
111
+ | Browser | Google Chrome 116 or newer (Edge, Brave and Chromium are registered too, but only Chrome is tested) |
112
+ | Runtime | Node.js 20 or newer |
113
+ | Account | A ChatGPT account that can generate images, signed in to chatgpt.com in Chrome |
114
+ | Client | Claude Code, the Claude desktop app, Codex, Cursor, VS Code or Gemini CLI (or another MCP client that runs stdio servers) |
115
+
116
+ Windows only for now — the code is split into a platform module and macOS/Linux contributions are
117
+ welcome. Everything OS-specific (named pipe, native host registration, user folders) lives in
118
+ `platform/win32.js`.
119
+
120
+ ## Installation
121
+
122
+ ### Quick install
123
+
124
+ Run this in PowerShell or cmd (no admin rights needed):
125
+
126
+ ```
127
+ npx backdraw@latest setup
128
+ ```
129
+
130
+ It runs the [`backdraw` package from npm](https://www.npmjs.com/package/backdraw).
131
+
132
+ `setup` does everything except one click in the browser:
133
+
134
+ 1. It copies Backdraw to `%USERPROFILE%\.backdraw` (npx's own copy is temporary) and sets up the
135
+ images folder `Pictures\Backdraw` (reference collections go to `Pictures\Backdraw\References`).
136
+ Running it again updates Backdraw and keeps your settings, job history and collections.
137
+ 2. It registers the native messaging host for your Windows user, for each browser it finds
138
+ (Chrome, Edge, Brave, Chromium).
139
+ 3. It lists the MCP clients it finds (Claude Code, the Claude desktop app, Codex, Cursor, VS Code,
140
+ Gemini CLI) and asks which ones to add Backdraw to. Only the `backdraw` entry is added or
141
+ updated, and every config file gets a timestamped `.bak` copy before it changes.
142
+ `--yes` takes every client it found; `--clients=claude-code,cursor` takes exactly those.
143
+ 4. It opens the extension folder and your browser's extensions page, copies the folder path to the
144
+ clipboard, and waits for you to **load the extension**, the one step left to you:
145
+ 1. turn on **Developer mode** (top right),
146
+ 2. click **Load unpacked**,
147
+ 3. pick the folder (paste the path with Ctrl+V).
148
+
149
+ As soon as the extension connects, setup prints **✓ Ready** and an example prompt.
150
+
151
+ The native host is still named `io.github.muhammedtalha04.backdraw`, after the project's old GitHub
152
+ user name: renaming it would break existing installs.
153
+
154
+ ### Install from your client
155
+
156
+ Your MCP client can also add Backdraw itself; it then starts the server with
157
+ `npx backdraw@latest mcp`. The browser side still needs a one-time setup on the PC, which leaves the
158
+ clients alone:
159
+
160
+ ```
161
+ npx backdraw@latest setup --clients=none
162
+ ```
163
+
164
+ | Client | Add Backdraw |
165
+ |---|---|
166
+ | Claude Code | `/plugin install backdraw --marketplace devtalh/backdraw` (Claude Code 2.1.275 or later; or `/plugin marketplace add devtalh/backdraw`, then `/plugin install backdraw@backdraw`). `/backdraw:setup` explains the browser step. |
167
+ | Cursor | [![Add Backdraw to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=backdraw&config=eyJjb21tYW5kIjoiY21kIiwiYXJncyI6WyIvYyIsIm5weCIsIi15IiwiYmFja2RyYXdAbGF0ZXN0IiwibWNwIl19) |
168
+ | VS Code | [![Install Backdraw in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=backdraw&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22cmd%22%2C%22args%22%3A%5B%22%2Fc%22%2C%22npx%22%2C%22-y%22%2C%22backdraw%40latest%22%2C%22mcp%22%5D%7D) |
169
+ | Codex | `codex mcp add backdraw -- cmd /c npx -y backdraw@latest mcp` |
170
+ | Gemini CLI | `npx backdraw@latest setup --clients=gemini` |
171
+
172
+ On Windows the command goes through `cmd /c`, because clients start `npx` without a shell. Use one
173
+ way per client: if setup already added Backdraw to Claude Code, the plugin would start a second
174
+ server with the same tools.
175
+
176
+ ### Manual install
177
+
178
+ 1. **Get the code.** Clone the repository with git, or download it as a ZIP (**Code** →
179
+ **Download ZIP**) and unzip it:
180
+
181
+ ```
182
+ git clone https://github.com/devtalh/backdraw.git
183
+ cd backdraw
184
+ ```
185
+ 2. **Run the installer** in that folder (no admin rights needed):
186
+
187
+ ```
188
+ node install.js
189
+ ```
190
+
191
+ It does steps 1 and 2 above and adds Backdraw to Claude Code (user scope). For the other
192
+ clients, run `node bin/backdraw.js setup` instead, or see [Use it](#use-it).
193
+ 3. **Load the extension** once: open `chrome://extensions`, turn on **Developer mode**, click
194
+ **Load unpacked** and select `%USERPROFILE%\.backdraw\extension`.
195
+
196
+ ### Finish in the popup
197
+
198
+ 1. **Open the popup.** Click the Backdraw icon in the toolbar (pin it from the puzzle-piece menu).
199
+ Until everything works, the popup shows a setup checklist with the fix for each step:
200
+ 1. the bridge is connected,
201
+ 2. you are signed in to ChatGPT,
202
+ 3. a ChatGPT Project is selected,
203
+ 4. ready: an example prompt to copy into Claude.
204
+ 2. **Create and select a ChatGPT Project.** In ChatGPT, create a Project for your images (for
205
+ example "Backdraw"), open it, click the Backdraw icon and press **Use the “Backdraw” project**.
206
+ You can also ask Claude: *"Select my Backdraw project in ChatGPT for images."* Every new image
207
+ chat is created inside that Project.
208
+
209
+ The popup also has a language (Auto / English / Türkçe) and a theme (Auto / Light / Dark) setting.
210
+ If something doesn't work, run [`npx backdraw@latest doctor`](#doctor).
211
+
212
+ ## Use it
213
+
214
+ ### From Claude Code
215
+
216
+ Start a **new** Claude Code session after installing (MCP servers are loaded when a session
217
+ starts) and ask in plain words, in any language. The `backdraw` server gives Claude these tools:
218
+ `generate_image`, `job_status`, `cancel_job`, `fetch_images`, `list_projects`, `select_project` and
219
+ `list_collections` (see [Tools reference](#tools-reference)).
220
+
221
+ ### From the Claude desktop app (chat)
222
+
223
+ The desktop app keeps its own MCP config for chats. Claude rewrites that config when it exits, so
224
+ Backdraw only changes it while Claude is closed. If setup found Claude running, add Backdraw later:
225
+
226
+ 1. Quit Claude **completely**, also from the system tray.
227
+ 2. Run this from **PowerShell** (not from a Claude session):
228
+
229
+ ```powershell
230
+ npx backdraw@latest setup --clients=claude-desktop
231
+ ```
232
+
233
+ (From a manual install: `node install.js --desktop` in `~\.backdraw`.) A timestamped `.bak` copy
234
+ of each config file is written before it is changed.
235
+ 3. Start Claude again. Backdraw is available in new chats.
236
+
237
+ ### From other MCP clients
238
+
239
+ `setup` adds Backdraw to Codex, Cursor, VS Code and Gemini CLI too: pick them when it asks, or run
240
+ `npx backdraw@latest setup --clients=codex,cursor,vscode,gemini`. It writes the full path of
241
+ `node.exe` as the command, so a client that doesn't see your `PATH` still finds it. Restart the
242
+ client or start a new session afterwards.
243
+
244
+ VS Code and Gemini CLI allow comments in their config files. Rewriting such a file would drop the
245
+ comments, so setup leaves a file with comments alone and tells you; add the entry by hand then.
246
+
247
+ Backdraw is a plain stdio MCP server: `node %USERPROFILE%\.backdraw\mcp-server.js`. To add it by
248
+ hand, use the examples below. In the config files, replace `C:/Users/you` with your home folder
249
+ (`echo %USERPROFILE%` in cmd prints it). Forward slashes work on Windows and need no escaping in
250
+ JSON. `~` below is your home folder. The PowerShell commands fill in the path themselves.
251
+
252
+ **Codex** (the CLI, the IDE extension and the app share `~\.codex\config.toml`;
253
+ [docs](https://learn.chatgpt.com/docs/extend/mcp)). From PowerShell:
254
+
255
+ ```powershell
256
+ codex mcp add backdraw -- node "$env:USERPROFILE\.backdraw\mcp-server.js"
257
+ ```
258
+
259
+ or in `config.toml`:
260
+
261
+ ```toml
262
+ [mcp_servers.backdraw]
263
+ command = "node"
264
+ args = ["C:/Users/you/.backdraw/mcp-server.js"]
265
+ ```
266
+
267
+ **Cursor** (`~\.cursor\mcp.json` for all projects, or `.cursor\mcp.json` in a project;
268
+ [docs](https://cursor.com/docs/context/mcp)). Cursor fills in `${userHome}` itself:
269
+
270
+ ```json
271
+ {
272
+ "mcpServers": {
273
+ "backdraw": {
274
+ "type": "stdio",
275
+ "command": "node",
276
+ "args": ["${userHome}/.backdraw/mcp-server.js"]
277
+ }
278
+ }
279
+ }
280
+ ```
281
+
282
+ **VS Code** (GitHub Copilot agent mode: run **MCP: Open User Configuration** for every workspace,
283
+ or create `.vscode\mcp.json` in one; [docs](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)).
284
+ Here the key is `servers` and `type` is required:
285
+
286
+ ```json
287
+ {
288
+ "servers": {
289
+ "backdraw": {
290
+ "type": "stdio",
291
+ "command": "node",
292
+ "args": ["C:/Users/you/.backdraw/mcp-server.js"]
293
+ }
294
+ }
295
+ }
296
+ ```
297
+
298
+ **Gemini CLI** (`~\.gemini\settings.json`;
299
+ [docs](https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md)). `-s user`
300
+ adds it for all projects (the default is the current project only). From PowerShell:
301
+
302
+ ```powershell
303
+ gemini mcp add -s user backdraw node "$env:USERPROFILE\.backdraw\mcp-server.js"
304
+ ```
305
+
306
+ or in `settings.json`:
307
+
308
+ ```json
309
+ {
310
+ "mcpServers": {
311
+ "backdraw": {
312
+ "command": "node",
313
+ "args": ["C:/Users/you/.backdraw/mcp-server.js"]
314
+ }
315
+ }
316
+ }
317
+ ```
318
+
319
+ ## Example prompts
320
+
321
+ | You say | What Claude passes to `generate_image` |
322
+ |---|---|
323
+ | *Generate an image with ChatGPT: a cozy reading nook by a rainy window, warm lamp light.* | a detailed `prompt` |
324
+ | *Make a 16:9 banner for my blog with ChatGPT: "Night Shift Notes", neon city at dusk.* | `aspect_ratio: "16:9"` |
325
+ | *Use ChatGPT to make a sticker of a happy cactus with a transparent background.* | `transparent_background: true` |
326
+ | *Edit `C:\path\to\photo.png` with ChatGPT: turn the sky into a sunset, keep everything else.* | `reference_images: ["C:\\path\\to\\photo.png"]` |
327
+ | *Use my "Cats" collection as reference and make a poster with ChatGPT.* | `reference_collection: "Cats"` |
328
+
329
+ To edit an image, Backdraw needs it as a file on your PC: give Claude its full path (type or paste
330
+ it) so Claude can pass it in `reference_images`. Files saved by earlier calls work directly. A fresh
331
+ chat with the image attached is the most reliable way to edit.
332
+
333
+ You can also ask *"What's the status of the ChatGPT image job?"* or *"Cancel it."*
334
+
335
+ ## Reference collections
336
+
337
+ Collect images from the web, then use them as references.
338
+
339
+ 1. Right-click an image on any web page → **Add to Backdraw** → pick a collection, or
340
+ **New collection…** (a small window asks for the name).
341
+ 2. A short note in the page confirms it, e.g. "Added to Cats · 5 images". On pages where Chrome
342
+ doesn't let extensions show anything, the toolbar icon flashes a ✓ (or a red ! on error) instead.
343
+ 3. Ask Claude to use the collection by name.
344
+
345
+ Each collection is a folder `Pictures\Backdraw\References\<collection>\` with the images (named by
346
+ Backdraw: `001_<name>.png`, …), a `collection.json` with the source page and date of each image,
347
+ and a `thumbs\` folder. Adding the same image to a collection twice keeps one copy. PNG, JPEG, WebP
348
+ and GIF are kept as they are; other formats Chrome can show (such as AVIF, BMP or SVG) are saved as
349
+ PNG. If you delete an image file by hand, it drops out of the collection.
350
+
351
+ The popup's **Collections** section lists your collections. Open one to see its thumbnails, delete
352
+ images, or rename or delete the collection.
353
+
354
+ | Limit | |
355
+ |---|---|
356
+ | References per message | 16 (`reference_images` and collection images together; ChatGPT accepted 16 in testing) |
357
+ | One reference | 20 MB |
358
+ | All references of one message | 80 MB |
359
+ | One collection image | 25 MB (an image over 20 MB stays in the collection; requests leave it out and say so, and naming it in `reference_files` makes the request fail with a message) |
360
+
361
+ A request uses the **newest** images of the collection that fit in the free slots. To use specific
362
+ ones, name them: Claude passes their file names (from `list_collections`) in `reference_files`.
363
+
364
+ ## Sizes and transparency
365
+
366
+ ### `aspect_ratio`
367
+
368
+ `W:H` with whole numbers, anywhere from `1:4` to `4:1`: `1:1`, `3:2`, `2:3`, `4:5`, `16:9`, `9:16`,
369
+ `5:2` (Discord banner), `3:1`, `4:1`, … `1920:1080` is reduced to `16:9`; write `3:2`, not `1.5:1`.
370
+ A few names work too: `square`, `landscape` (3:2), `portrait` (2:3), `wide` (16:9), `tall` (9:16),
371
+ `discord-banner` (5:2).
372
+
373
+ - **1:3 to 3:1:** ChatGPT draws these itself, at about 1.57 megapixels in the asked shape. Observed
374
+ in October 2026: 1254×1254 (1:1), 1536×1024 (3:2), 1672×941 (16:9), 1983×793 (5:2).
375
+ - **Up to 4:1 / 1:4:** ChatGPT is asked for 3:1 (or 1:3) and told to keep subjects, faces and text
376
+ inside the band that survives the crop; Backdraw then crops it from the centre.
377
+ - An image more than 1% off the asked ratio is cropped from the centre. The crop is the main file
378
+ (`<name>.png`) and ChatGPT's original stays next to it as `<name>_full.<ext>`. `output_dir`
379
+ copies get the main file only.
380
+ - If ChatGPT drew another shape and the crop had to cut more than planned, the result warns you to
381
+ check for cut-off subjects or text.
382
+
383
+ ### `transparent_background`
384
+
385
+ `transparent_background: true` asks ChatGPT for a PNG with an alpha channel that shows only the
386
+ subject. ChatGPT doesn't always deliver, so Backdraw checks the saved image: it reads the PNG header
387
+ (alpha channel or `tRNS` chunk) and measures the share of see-through pixels. The result says
388
+ either
389
+
390
+ ```
391
+ Transparent background: yes — PNG with an alpha channel, 61% of the pixels are transparent.
392
+ ```
393
+
394
+ or starts with `⚠ TRANSPARENT BACKGROUND MISSING` (no alpha channel, or 2% or fewer of the pixels are transparent). Then
395
+ retry once in a fresh chat or remove the background with another tool. Previews of transparent
396
+ images are drawn over a checkerboard.
397
+
398
+ ## Gallery side panel
399
+
400
+ Click **Open gallery** in the popup to open Backdraw's side panel next to the page you are on. You
401
+ can also right-click the Backdraw toolbar icon → **Open Backdraw gallery**.
402
+
403
+ - **Top:** the job in progress (step, job id and elapsed time; hover for ChatGPT's message), "Idle",
404
+ or a not-connected notice.
405
+ - **Gallery:** your generated images, newest first, 12 at a time (**Load more**), each with a
406
+ thumbnail, the date, the prompt (hover to see its first 300 characters), the size and, if one was
407
+ asked, the aspect ratio.
408
+ - **Per image:** **Open chat**, **Show in folder** (Explorer with the file selected),
409
+ **Copy path** and **Add to collection** (an existing collection or **New collection…**).
410
+
411
+ The gallery lists the images of the job history, which keeps the last 100 jobs. Thumbnails come
412
+ from the previews, which are kept for 7 days; older images show a placeholder. The image files
413
+ themselves stay in your images folder.
414
+
415
+ ## Tools reference
416
+
417
+ | Tool | Parameters (default) | What it does |
418
+ |---|---|---|
419
+ | `generate_image` | `prompt` (required), `aspect_ratio`, `transparent_background` (false), `reference_images`, `reference_collection`, `reference_files`, `conversation_url`, `auto_reattach` (false), `send_as_is` (false), `output_dir`, `wait_seconds` (45), `include_preview` (true) | Starts a new chat in your Project (or continues `conversation_url`) and generates or edits an image. |
420
+ | `job_status` | `job_id`, `wait_seconds` (45), `include_preview` (true) | Waits for a job and reports it. Without `job_id`: the bridge status (Chrome connected, selected Project, images folder, queue, recent jobs). |
421
+ | `cancel_job` | `job_id` (required) | Cancels a queued or running job. If ChatGPT is already generating, it presses Stop in the background tab. |
422
+ | `fetch_images` | `conversation_url` (required), `aspect_ratio`, `output_dir`, `wait_seconds` (45), `include_preview` (true) | Downloads the images of the latest answer in an existing chat, without sending anything. |
423
+ | `list_projects` | – | Lists your ChatGPT Projects and shows the selected one. |
424
+ | `select_project` | `name` or `url` | Selects and remembers the Project for new image chats (the name is matched loosely). |
425
+ | `list_collections` | – | Lists your reference collections with image counts, folders and files (newest first). |
426
+
427
+ - `reference_images`: local png / jpg / webp / gif files, up to 16; collection images fill the
428
+ slots that are left.
429
+ - `reference_files`: file names from `list_collections`, to attach only those images of `reference_collection`.
430
+ - `conversation_url`: a `https://chatgpt.com/` chat link. Fine for quick follow-ups; for exact
431
+ edits a fresh chat with `reference_images` works better.
432
+ - `auto_reattach`: if ChatGPT says it can't see the image and asks for it again, attach it
433
+ automatically and ask once more.
434
+ - `send_as_is`: send the prompt word for word, without the short instruction Backdraw adds (e.g. to
435
+ answer a question ChatGPT asked).
436
+ - `output_dir`: also copy the result into this folder; the images folder always keeps a copy.
437
+ - `wait_seconds`: 0 to 900.
438
+
439
+ What a result can say:
440
+
441
+ | Result | Meaning |
442
+ |---|---|
443
+ | `SUCCESS` | Saved file path(s), the chat link and a preview. Edits add an **edit check** line. |
444
+ | `STILL RUNNING` / `QUEUED` | Not done yet; Claude keeps calling `job_status` with the job id. |
445
+ | `NEEDS USER ACTION` | ChatGPT shows a login or human-verification page (see [Troubleshooting](#troubleshooting)). |
446
+ | `NEEDS REFERENCE IMAGE` | ChatGPT couldn't reach the image it should edit. The result lists images already saved from that chat. |
447
+ | `CHATGPT REPLIED WITHOUT AN IMAGE` | ChatGPT answered in text (a question, a refusal, a limit); up to 3,000 characters of it are included. |
448
+ | `FAILED` / `CANCELLED` | With the reason, and the chat link if there is one. |
449
+
450
+ ## Fast return
451
+
452
+ Generating usually takes 1-3 minutes, but `generate_image`, `fetch_images` and `job_status` return
453
+ within **45 seconds** by default (`wait_seconds`). If the image isn't ready yet, the result is
454
+ `STILL RUNNING` or `QUEUED` (with the queue position) plus a job id, and Claude calls
455
+ `job_status(job_id, wait_seconds=45)` again until the job is done.
456
+
457
+ Clients that reach your PC from the cloud often give up on a tool call after 60 seconds; the
458
+ 45-second default keeps these calls under that limit. When the client asks for progress, Backdraw
459
+ sends progress notifications while it waits. Cancelling a tool call in the client only stops the
460
+ waiting; the job keeps running until `cancel_job` stops it.
461
+
462
+ ## CLI
463
+
464
+ For setup and troubleshooting, run these in the Backdraw folder (`%USERPROFILE%\.backdraw`, or the
465
+ folder you installed from). From anywhere, `npx backdraw <command>` runs the same commands, e.g.
466
+ `npx backdraw status`. `npm run status` is the same as `node cli.js status`. `backdraw mcp` runs
467
+ the MCP server itself on stdio; that is what MCP clients start.
468
+
469
+ ```
470
+ node cli.js status Bridge status (Chrome connected, selected project, queue)
471
+ node cli.js projects List ChatGPT projects
472
+ node cli.js select <name | link> Select the project where images are generated
473
+ node cli.js generate "<prompt>" [--ref IMAGE]... [--url CHAT_LINK] [--aspect W:H] [--transparent]
474
+ [--reattach] [--out FOLDER] [--raw] [--wait 300] [--collection NAME [--file FILE]...]
475
+ Generate an image (--ref: a reference or the image to edit, up to 16)
476
+ node cli.js collect <chat link> [--aspect W:H] [--out FOLDER]
477
+ Download the latest images of an existing chat (sends nothing)
478
+ node cli.js job <id> [--wait 60] Show a job's status
479
+ node cli.js cancel <id> Cancel a job
480
+ node cli.js collections List the reference collections
481
+ node cli.js collection <name> Show one collection and its images
482
+ node cli.js outdir <folder> Change the central images folder
483
+ node cli.js debug on|off Verbose logging (logs\host.log)
484
+ node cli.js diagnose [link] [--selector CSS] [--max N] [--worker]
485
+ Page diagnostics
486
+ node cli.js reload Reload the Chrome extension
487
+ ```
488
+
489
+ Examples:
490
+
491
+ ```
492
+ node cli.js generate "a lighthouse at dawn, watercolor" --aspect 16:9
493
+ node cli.js generate "close only the eyes" --ref C:\path\to\portrait.png
494
+ node cli.js collect https://chatgpt.com/c/<chat id> --aspect 16:9
495
+ ```
496
+
497
+ ## Doctor
498
+
499
+ ```
500
+ npx backdraw@latest doctor checks everything, changes nothing
501
+ npx backdraw@latest doctor --fix repairs what is safe to repair, then checks again
502
+ ```
503
+
504
+ `doctor` prints one line per check, ✓ (fine), ⚠ (worth a look) or ✗ (broken), each with a one-line
505
+ fix:
506
+
507
+ - Node.js version, the install folder, and that its files, the extension and this version match.
508
+ - The host manifest and, for each installed browser, the registry entry it really reads (also
509
+ from inside the Claude desktop app's MSIX sandbox).
510
+ - Browser policies that switch off per-user native hosts (`NativeMessagingUserLevelHosts`) or block
511
+ them (`NativeMessagingBlocklist`). Only an administrator can change these.
512
+ - The bridge (named pipe), the extension and its version, the ChatGPT sign-in as the extension
513
+ last saw it, and whether a Project is selected.
514
+ - Every MCP client's Backdraw entry: there, and pointing to this install. It also says whether the
515
+ Claude desktop app is running.
516
+
517
+ `--fix` rewrites the host manifest and the registry entries, and points client entries back at
518
+ this install (with a backup; the Claude desktop app only while it is closed). It says what it
519
+ couldn't fix. The output is safe to paste into an issue: your home folder is shown as `~`, and
520
+ project names, prompts and chat links are never printed.
521
+
522
+ ## Troubleshooting
523
+
524
+ | Problem | What to do |
525
+ |---|---|
526
+ | Anything | Run `npx backdraw@latest doctor` first. |
527
+ | `BRIDGE NOT RUNNING` | Chrome is closed, or the extension is not loaded or turned off. Open Chrome (the extension connects by itself) or turn Backdraw on at `chrome://extensions`. Check with `node cli.js status`. |
528
+ | Red **!** on the Backdraw icon | The extension can't reach the local host. The popup shows the error and the fix. Run `npx backdraw@latest doctor --fix` (or `node install.js` again), then reload Backdraw at `chrome://extensions`. |
529
+ | `NEEDS USER ACTION` | ChatGPT shows a login or a human verification (CAPTCHA). Open the ChatGPT tab in Chrome and finish it yourself; Backdraw never tries to get around it. The job waits up to 10 minutes for you; as soon as you finish, it continues by itself. After 10 minutes it fails and leaves the ChatGPT tab open. |
530
+ | `⚠ EDIT CHECK (edited: false)` | ChatGPT drew a new picture instead of editing (a real edit keeps ~95-100% of the image). Ask again with the original in `reference_images` and without `conversation_url`, i.e. in a fresh chat. |
531
+ | `NEEDS REFERENCE IMAGE` | ChatGPT lost track of the image in a long chat. Attach it with `reference_images` (best in a fresh chat) or use `auto_reattach`. |
532
+ | `FAILED — ChatGPT did not finish in time` | A job gives up after about 10 minutes. If the result has a chat link, `fetch_images` (or `node cli.js collect <link>`) downloads the image once ChatGPT has finished; pass the same `aspect_ratio` again to crop it the same way. |
533
+ | `No ChatGPT project is selected yet` | Select one in the popup, or ask Claude to list and select your Projects. |
534
+ | `ChatGPT did not open the project` | The Project was deleted or renamed; select it again. |
535
+ | Two Chrome profiles | The local bridge is one per Windows user, so load Backdraw in one Chrome profile only. |
536
+
537
+ For a detailed log, run `node cli.js debug on` and look at `%USERPROFILE%\.backdraw\logs\host.log`
538
+ (turn it off again with `node cli.js debug off`).
539
+
540
+ ### If the ChatGPT web UI changes
541
+
542
+ Backdraw drives the chatgpt.com web page, so a redesign can break it (for example, it can no longer
543
+ find the message box).
544
+
545
+ 1. Run `node cli.js diagnose` (or `node cli.js diagnose <chat link>`). It prints a summary of the
546
+ page structure Backdraw sees; `--selector CSS` and `--max N` narrow it down, `--worker` looks at
547
+ the tab of the running job.
548
+ 2. The selectors live in `extension/inpage.js`.
549
+ 3. After a fix, run `node install.js` again: it copies the files and reloads the running extension.
550
+ 4. Please [open an issue](../../issues) with what changed. Remove personal details (chat titles,
551
+ project names, prompts) from the diagnose output first.
552
+
553
+ ## Updating
554
+
555
+ ```
556
+ npx backdraw@latest setup
557
+ ```
558
+
559
+ From a manual install: `git pull` (or download the ZIP again), then `node install.js`.
560
+
561
+ Both copy the new files over the old ones, keep your settings, job history and collections,
562
+ register everything again and reload the running extension. If Chrome was closed, it loads the new
563
+ version when it starts.
564
+
565
+ **Coming from the "ChatGPT image bridge" (1.x)?** Setup (or `node install.js`) migrates it: it copies the
566
+ settings and job history from `%USERPROFILE%\.claude\chatgpt-image-bridge` (never overwriting) and
567
+ removes the old native host and the old `chatgpt-images` MCP entry. Then, at `chrome://extensions`,
568
+ remove the old "Claude ChatGPT Görsel Köprüsü" extension and load `%USERPROFILE%\.backdraw\extension`
569
+ instead; the extension ID stays the same. Delete the old folder by hand once Backdraw works.
570
+
571
+ ## Uninstall
572
+
573
+ ```
574
+ npx backdraw@latest uninstall --dry-run shows what would be removed, changes nothing
575
+ npx backdraw@latest uninstall
576
+ ```
577
+
578
+ (From a manual install: `node install.js --uninstall [--dry-run]`.) This removes the native host
579
+ registration of every browser, and the `backdraw` MCP entry from Claude Code, Codex, Cursor,
580
+ VS Code and Gemini CLI and, while Claude is closed, from the desktop app's config (each with a
581
+ backup), plus the names used by 1.x. Then remove the extension at `chrome://extensions`.
582
+
583
+ Your files are kept, in two places:
584
+
585
+ - `%USERPROFILE%\.backdraw`: the program, your settings, the job history (with prompts), previews
586
+ and logs.
587
+ - The images folder, `Pictures\Backdraw` by default: your generated images and, under
588
+ `References`, your reference collections. The dry run lists the folders actually used, and so
589
+ does `node cli.js status` before you uninstall.
590
+
591
+ Delete these folders by hand if you want them gone. Coming from 1.x? Delete
592
+ `%USERPROFILE%\.claude\chatgpt-image-bridge` too.
593
+
594
+ ## Privacy & security
595
+
596
+ - Everything runs on your PC: no Backdraw server, no telemetry, no API key.
597
+ - Backdraw never reads cookies, tokens or passwords, and never automates logins or CAPTCHAs: you complete them yourself.
598
+ - The local bridge is a named pipe, not a network port, and the native host only accepts the
599
+ Backdraw extension.
600
+ - Prompts, job history, previews and logs stay in `%USERPROFILE%\.backdraw` (`data\` and `logs\`).
601
+ - `reference_images` can attach any local file whose name ends in `.png`, `.jpg`, `.jpeg`, `.webp` or
602
+ `.gif` to a ChatGPT message. Review Backdraw's tool calls when Claude works with content you don't
603
+ trust.
604
+
605
+ Details, the threat model and how to report a vulnerability: [SECURITY.md](SECURITY.md).
606
+
607
+ ## MCP protocol support
608
+
609
+ - **2026-07-28** (stateless): no handshake; each request names its version in `_meta`;
610
+ `server/discover` is supported.
611
+ - **Legacy `initialize` handshake:** 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05.
612
+ - Tool titles and annotations, progress notifications, `notifications/cancelled` and JSON-RPC
613
+ batches. An unsupported version gets error `-32022` with the list of supported ones.
614
+
615
+ ## Disclaimer and responsible use
616
+
617
+ - **Personal use, your own account.** Backdraw is made for one person generating images with
618
+ their own ChatGPT account in their own Chrome. Don't use it to share an account, to generate
619
+ images for other people as a service, or as the backend of a product.
620
+ - **OpenAI's terms.** OpenAI's [Terms of Use](https://openai.com/policies/row-terms-of-use/) say
621
+ you may not "automatically or programmatically extract data or Output", nor get around rate
622
+ limits or protective measures. Backdraw drives the ChatGPT web page for you, so using it may
623
+ conflict with these terms. Read them and decide for yourself.
624
+ - **The risk to your account is yours.** OpenAI may limit, suspend or close an account it finds
625
+ in breach of its terms. Backdraw comes without any warranty ([MIT license](LICENSE)), and its
626
+ authors are not responsible for what happens to your account.
627
+ - **One job at a time, at a human pace.** There is a single queue: one prompt in one background
628
+ tab, and the next job starts only after the image is saved. Backdraw doesn't open parallel
629
+ chats, doesn't resend prompts on its own (apart from the single re-ask of `auto_reattach`) and
630
+ stops at every login or human-verification page until you finish it yourself.
631
+ - **Your normal limits apply.** Every image counts toward your own ChatGPT usage limits.
632
+ - Not affiliated with, endorsed or sponsored by OpenAI or Anthropic.
633
+
634
+ ## License
635
+
636
+ [MIT](LICENSE)