From b3f953918918aae7fb3fbf28fee0d20195e7a06d Mon Sep 17 00:00:00 2001 From: bmondream Date: Sun, 13 Sep 2026 10:22:33 +0200 Subject: [PATCH] feat: support multiple color correction inputs --- image-color-correction/warm_print.py | 38 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/image-color-correction/warm_print.py b/image-color-correction/warm_print.py index 5e936f9..15c82d6 100644 --- a/image-color-correction/warm_print.py +++ b/image-color-correction/warm_print.py @@ -10,7 +10,7 @@ Apply a warm print color correction (less blue, slightly yellower). Usage with uv (no venv, no uv pip): - uv run warm_print.py /path/to/image.jpg + uv run warm_print.py image.jpg other.jpg /path/to/more.jpg uv reads the dependencies in the header above and installs them into an isolated cache on first run. @@ -83,17 +83,8 @@ def warm_correct(im: Image.Image) -> Image.Image: return out_im -def main() -> int: - if len(sys.argv) < 2: - print("Usage: python warm_print.py /path/to/image.jpg", file=sys.stderr) - return 2 - - src = Path(sys.argv[1]).expanduser().resolve() - if not src.is_file(): - print(f"Not a file: {src}", file=sys.stderr) - return 1 - - # Same folder, same name, short suffix before the original extension. +def process_one(src: Path) -> Path: + """Color-correct one image and write sibling *_warmprint file.""" dest = src.with_name(f"{src.stem}_warmprint{src.suffix}") im = Image.open(src) @@ -112,8 +103,27 @@ def main() -> int: out_im.save(dest, "JPEG", **save_kwargs) else: out_im.save(dest, "PNG", **save_kwargs) - print(dest) - return 0 + return dest + + +def main() -> int: + if len(sys.argv) < 2: + print( + "Usage: python warm_print.py image.jpg [more.jpg ...]", + file=sys.stderr, + ) + return 2 + + failed = 0 + for raw in sys.argv[1:]: + src = Path(raw).expanduser().resolve() + if not src.is_file(): + print(f"Not a file: {src}", file=sys.stderr) + failed += 1 + continue + dest = process_one(src) + print(dest) + return 1 if failed else 0 if __name__ == "__main__":