Skip to content

willbr/ultra-house

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ultra-house

Save every image you've opened in Brave tabs, in one go. Python + ctypes, zero dependencies for the main flow.

What it does

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:

  1. Find a Brave window whose active tab is an image viewer.
  2. Send Ctrl+S → Save As dialog opens on the image.
  3. Send Enter → accepts the default filename and location.
  4. Send Ctrl+W → closes the tab, next image tab becomes active.
  5. Repeat.

Hold Esc between iterations to abort.

Requirements

  • Windows (tested on Windows 11; should work anywhere user32/gdi32 exist)
  • Python 3.8+
  • No pip install needed for the save flow
  • Optional: pillow + numpy if you want ultrahouse.find_template_fuzzy for noise-tolerant image matching

Usage

python save_images.py           # save one image tab
python save_images.py 50        # save up to 50 sequential image tabs
python save_images.py --help

Files 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 — the underlying library

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.

How it decides which window is a Brave image tab

  1. EnumWindows → visible top-level windows only.
  2. Filter to class Chrome_WidgetWin_1 (Chromium browsers — rules out terminals, editors, file managers that might happen to have (W×H) in their titles).
  3. 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.

Limitations

  • 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_template is exact byte match — a template captured at one DPI won't match a screenshot at a different DPI. Use find_template_fuzzy (with pillow+numpy) for that.
  • The Enter after Ctrl+S will accept "overwrite?" prompts automatically. If that's not what you want, handle the prompt yourself before the loop runs.

Files

  • save_images.py — the script
  • ultrahouse.py — the library
  • static/ — reference template PNGs, available for use via find_template but not used by the main save flow
  • CLAUDE.md — repo guide for AI coding assistants

About

I'm merely a pile of circuits and microchips.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages