summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-09-10 22:24:35 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-09-10 22:24:35 +0200
commit5269bd720bbc44e947e456b7af1ab9518a1b8812 (patch)
treeaf1bb26f3ad9af702859796c7a1681245e5ed8dc /bin
parentccb3a9e06fd54c91bcdad274d124c4a8f8d686b8 (diff)
add --resize option
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pyggle18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/pyggle b/bin/pyggle
index a7e6ec5..8b9196f 100755
--- a/bin/pyggle
+++ b/bin/pyggle
@@ -536,6 +536,12 @@ if __name__ == "__main__":
default=16,
help="Zoom Level for reverse geocoding",
)
+ parser.add_argument(
+ "--resize",
+ metavar="N",
+ type=int,
+ help="resize large images to no more than NxN pixels (IN-PLACE EDIT)",
+ )
parser.add_argument("--reverse", action="store_true", help="Reverse sort order")
parser.add_argument(
"--scrub-metadata",
@@ -587,9 +593,19 @@ if __name__ == "__main__":
continue
thumbnails.append(
- Thumbnail(filename, im, size=args.size, with_gps=args.with_nominatim)
+ Thumbnail(filename, im.copy(), size=args.size, with_gps=args.with_nominatim)
)
+ if args.resize and (im.size[0] > args.resize or im.size[1] > args.resize):
+ subprocess.run(
+ [
+ "mogrify",
+ "-resize",
+ f"{args.resize}x{args.resize}",
+ filename,
+ ]
+ )
+
if args.scrub_metadata:
subprocess.run(
[