Save every image you've opened in Brave tabs, in one go. Python + ctypes, zero dependencies for the main flow.
You have 50 images open in Brave tabs. Each one renders at its own URL with (WIDTH×HEIGHT) in the tab title. The script walks through them:
- Find a Brave window whose active tab is an image viewer.
- Send
Ctrl+S→ Save As dialog opens on the image. - Send
Enter→ accepts the default filename and location. - Send
Ctrl+W→ closes the tab, next image tab becomes active. - Repeat.
Hold Esc between iterations to abort.
- Windows (tested on Windows 11; should work anywhere user32/gdi32 exist)
- Python 3.8+
- No pip install needed for the save flow
- Optional:
pillow+numpyif you wantultrahouse.find_template_fuzzyfor noise-tolerant image matching
python save_images.py # save one image tab
python save_images.py 50 # save up to 50 sequential image tabs
python save_images.py --helpFiles go to your browser's default download folder. If the Save As dialog or the file write is slow on your machine, tune SAVE_DIALOG_DELAY and SAVE_COMPLETE_DELAY at the top of save_images.py.
ultrahouse.py is a standalone, zero-dependency Windows GUI automation module. It's what save_images.py is built on, and you can import it from your own scripts:
import ultrahouse as uh
# Windows
for hwnd, title, cls in uh.enumerate_windows():
...
uh.activate_window(hwnd)
# Keyboard
uh.press_combo(uh.VK_CONTROL, uh.VK_S)
# Mouse — duration=0 teleports, >0 lerps
uh.move_and_click(1000, 500, duration=0.2)
# Screen capture (all monitors, physical pixels on HDPI)
pixels, w, h = uh.capture_screen()
# Template search — exact (zero-dep)
pos = uh.find_template('static/save_button.png')
# Template search — fuzzy (pillow + numpy, tolerant of AA / DPI)
hit = uh.find_template_fuzzy('static/save_button.png', threshold=0.9)It handles multi-monitor virtual-screen coordinates and sets per-monitor DPI awareness at import time.
EnumWindows→ visible top-level windows only.- Filter to class
Chrome_WidgetWin_1(Chromium browsers — rules out terminals, editors, file managers that might happen to have(W×H)in their titles). - Filter to titles matching
\(\d+×\d+\)where×is U+00D7 (the actual character Brave uses).
The regex will also pick up Chrome/Edge/Vivaldi tabs — if you have multiple Chromium browsers with image tabs open, the one that gets saved is non-deterministic.
- Windows-only.
- Tabs inside one Brave window share a single HWND, so the main loop re-queries the window each iteration. If a non-image tab becomes active mid-run the loop stops cleanly.
find_templateis exact byte match — a template captured at one DPI won't match a screenshot at a different DPI. Usefind_template_fuzzy(with pillow+numpy) for that.- The
EnterafterCtrl+Swill accept "overwrite?" prompts automatically. If that's not what you want, handle the prompt yourself before the loop runs.
save_images.py— the scriptultrahouse.py— the librarystatic/— reference template PNGs, available for use viafind_templatebut not used by the main save flowCLAUDE.md— repo guide for AI coding assistants