Skip to content

Browse for folders, upscale images, and skip macOS metadata files - #9

Merged
ftymoshchuk merged 3 commits into
mainfrom
claude/cool-sagan-yo0prg
Oct 16, 2026
Merged

ftymoshchuk merged 3 commits into
mainfrom
claude/cool-sagan-yo0prg

Conversation

@ftymoshchuk

Copy link
Copy Markdown
Owner

What changes

Browse for a folder

  • Browse… beside the folder field opens a folder browser, so a folder can be picked instead of typed. A web page can't learn the path of a folder picked with the browser's own chooser, and Pasteup needs the path: it reads the images in place and writes ---Created--- beside them. So the dialog lists folders through a new POST /api/jobs/browse-folder.
  • It opens at the folder in the field, else where browsing last stopped, else home. A typo opens the nearest folder that exists, with a note. Shortcuts: Home, Desktop, Documents, Downloads, Pictures, and each drive on Windows. The footer says how many images the folder holds, counted as the scan counts them.
  • Use this folder fills the field and scans it. In Many bundles mode it also checks every bundle, as Scan folder does; both now share scanFolderAndCheckBundles(). Typing a path still works.
  • Keyboard: arrow keys, Home/End, and Backspace to go up, landing on the folder just left. A folder Pasteup may not open, such as a Mac's Desktop under its privacy settings, gives way to the one above, with a note saying where to allow access.

Skip macOS metadata when scanning

  • A Mac writes a hidden ._name file beside the files it copies to an exFAT or FAT32 drive or some network shares. The scan counted them, so a 12-image bundle scanned as 24 images, and making sheets then reported 12 unreadable files. Hidden (dot) files are no longer images. One rule decides this for scans, sheets, covers and the browser's count.
  • Hidden folders (.Spotlight-V100, .Trashes, .fseventsd) and __MACOSX, left by unpacking a Mac-made zip, are no longer offered as bundles, all ticked. Covers no longer look inside them, nor inside a ---Created--- within the bundle.

Upscaled images

  • A third tile in step 3, Upscaled images, runs on its own, for one bundle or each picked bundle. Every image is made 2x, 3x or 4x bigger (Lanczos) and saved at the DPI from step 2:
    • ---Created---/<bundle>/Upscaled/PNG/<name>.png, keeping any transparency;
    • ---Created---/<bundle>/Upscaled/JPG/<name>.jpg, on white.
  • art.png and art.jpg would be saved over each other, so one gives both formats (PNG first) and the other is named in the result.
  • An image that would pass 100 megapixels once upscaled is left out before it is decoded, and unreadable files are skipped. Each is reported, per bundle in batch mode too.
  • Upscaling again replaces what the last run made.

API

  • New: POST /api/jobs/browse-folder, POST /api/jobs/upscale-images, POST /api/jobs/upscale-images-batch. All documented in the README.
  • Changed: scan-folder and generation no longer count or use hidden files. Hidden folders and __MACOSX are not detected as bundles, so the batch endpoints refuse them if selected.

Testing

  • ruff check .; pytest (193 tests, up from 158) on Python 3.11, 3.12 and 3.13.
  • New tests cover:
    • the browse endpoint: fallbacks, a folder it may not open, hidden folders, links kept as opened, shortcuts, and Windows hidden attributes through a stand-in;
    • the Mac-written drive, tested first against the old code, where it failed (24 images counted instead of 12);
    • upscaling: sizes, DPI, transparency, EXIF orientation, same-name files, too large, unreadable, re-runs and batch. The transparent-edge check fails a resize that doesn't premultiply alpha (edge red ~130 instead of ~218).
  • Driven in Chromium (Playwright) against a fake home folder and a fake Mac-written drive:
    • browsing by mouse and keyboard, in both modes;
    • slow, out-of-order and failed listings;
    • phone-size and short windows;
    • upscaling one bundle and many, with the files checked on disk.
  • Three source-text UI tests now pin code that moved: the scan flow's new function, the failure-render count, and a function signature.
  • Not run here: Windows (drive shortcuts, hiding system folders) and macOS (the privacy message). These are covered only by tests with stand-ins.

Known gaps

  • Built-in upscaling adds no detail, so at 4x clip art looks soft. An AI upscaler could come later as an optional install, like ffmpeg for videos.
  • On Windows, a drive root's System Volume Information and $RECYCLE.BIN are still offered as bundles. The browser hides them; the scan doesn't.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FtCFQJ6wEFf5pZSL2HSE8G


Generated by Claude Code

Browse… beside the folder field opens a dialog that lists folders through
a new POST /api/jobs/browse-folder. A page can't learn the path of a
folder picked with the browser's own file chooser, and Pasteup needs the
path: it reads the images in place and writes ---Created--- beside them.

The dialog opens at the folder in the field, so a typed path is a
shortcut, else where browsing last stopped, else home. Clicking a folder
opens it; the path above the list, Backspace and the shortcuts (home,
Desktop, Documents, Downloads, Pictures, and each drive on Windows) move
around; and the footer says how many images the folder holds, counted as
the scan counts them. "Use this folder" fills the field and scans it, and
in Many bundles mode checks every bundle, as Scan folder does; both now
share scanFolderAndCheckBundles(). Typing a path still works.

A folder that doesn't exist, or that Pasteup may not open, gives way to
the nearest one above it that can be listed, with a notice saying why
(and, on a Mac, where to allow access). Hidden folders and ---Created---
are left out, and links are not resolved, so ~/Dropbox stays ~/Dropbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtCFQJ6wEFf5pZSL2HSE8G
On an exFAT or FAT32 drive, or some network shares, a Mac writes a hidden
"._name" file beside the files it copies there: same extension, but no
image inside. The scan counted them, so a 12-image bundle scanned as 24
images, "enough for 2 full sheets"; making sheets then placed the 12 real
ones and reported 12 files as unreadable.

Hidden files, whose names start with a dot, are no longer images: that
covers the "._" files and matches what Finder shows. One rule,
is_image_file_name(), now decides for the scan, sheets, covers and the
folder browser's count, so they keep agreeing.

The same drives carry macOS's hidden .Spotlight-V100, .Trashes and
.fseventsd folders, and unpacking a Mac-made zip anywhere else leaves a
__MACOSX folder of "._" files. Batch mode offered all of these as
bundles, ticked. is_ignored_folder() leaves out hidden folders, __MACOSX
and ---Created--- wherever bundles are listed, in the scan and the batch
endpoints alike, and covers no longer look inside them. To prune them, a
cover's recursive listing moves from rglob to os.walk, which also keeps a
---Created--- inside the bundle, where an earlier cover may sit, out of
the next one. Symlinked folders are still not followed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtCFQJ6wEFf5pZSL2HSE8G
A new tile in step 3, Upscaled images, runs on its own, for one bundle or
for each picked bundle. Every image is made 2x, 3x or 4x bigger with
Lanczos resampling and saved in an Upscaled folder inside the bundle's
---Created--- folder: Upscaled/PNG/<name>.png, which keeps any
transparency, and Upscaled/JPG/<name>.jpg on white, both at the DPI from
step 2. POST /api/jobs/upscale-images and /upscale-images-batch do the
same through the API.

Pillow premultiplies alpha as it resamples, so a cutout's edge keeps its
colour instead of darkening towards the transparent pixels around it; a
test fails a resize that doesn't (edge red ~130 instead of ~218). Images
are read upright, as everywhere else, and an opaque one makes a PNG
without an alpha channel.

Files sharing a name, as art.png and art.jpg often do, would be saved
over each other, so one gives both formats (PNG, then WebP, then JPG)
and the other is named in the result. An image that would pass 100
megapixels once upscaled is left out before it is decoded, as pages are
capped, and unreadable files are skipped; each is reported, per bundle
in batch mode too. Upscaling again replaces what the last run made.

PNGs are written without optimize=True, which on a 4x upscale tripled
the time for a file no smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtCFQJ6wEFf5pZSL2HSE8G
@ftymoshchuk
ftymoshchuk merged commit bcca877 into main Oct 16, 2026
5 checks passed
@ftymoshchuk
ftymoshchuk deleted the claude/cool-sagan-yo0prg branch October 16, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants