画像ファイルだけを処理.

This commit is contained in:
corkborg
2023-10-11 17:45:20 +09:00
parent 7a243b4649
commit 953f24a1d4
+6 -2
View File
@@ -43,14 +43,18 @@ def image_interrogate(image_path: Path):
if args.dir:
d = Path(args.dir)
for f in d.iterdir():
tags = image_interrogate(Path(f))
if not f.is_file() or f.suffix not in ['.png', '.jpg', '.webp']:
continue
image_path = Path(f)
print('processing:', image_path)
tags = image_interrogate(image_path)
tags_str = ", ".join(tags.keys())
with open(f.parent / f"{f.stem}{args.ext}", "w") as fp:
fp.write(tags_str)
if args.file:
tags = image_interrogate(Path(args.file))
print()
tags_str = ", ".join(tags.keys())
print(tags_str)