"""One-shot conversion for raw/assets screenshots that have never been committed. Usage: python convert_asset.py [ ...] For each path, resizes (only if wider than MAX_WIDTH) and converts to WebP, deleting the original. Prints "\t" per success to stdout; prints failures to stderr and continues with the remaining files. Only call this on files with git status "??" or "A " (never appeared in any prior commit) — raw/ is otherwise read-only by convention. """ import sys from pathlib import Path from image_utils import convert_image MAX_WIDTH = 2000 QUALITY = 85 def main() -> None: if len(sys.argv) < 2: print("usage: convert_asset.py [ ...]", file=sys.stderr) sys.exit(1) for arg in sys.argv[1:]: path = Path(arg) try: output = convert_image(path, MAX_WIDTH, QUALITY) print(f"{path}\t{output}") except Exception as e: print(f"failed {path}: {e}", file=sys.stderr) if __name__ == "__main__": main()