diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-09-10 22:24:35 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-09-10 22:24:35 +0200 |
commit | 5269bd720bbc44e947e456b7af1ab9518a1b8812 (patch) | |
tree | af1bb26f3ad9af702859796c7a1681245e5ed8dc /bin | |
parent | ccb3a9e06fd54c91bcdad274d124c4a8f8d686b8 (diff) |
add --resize option
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pyggle | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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( [ |