From 5269bd720bbc44e947e456b7af1ab9518a1b8812 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 10 Sep 2021 22:24:35 +0200 Subject: add --resize option --- bin/pyggle | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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( [ -- cgit v1.2.3