summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-05-04 18:59:57 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-05-04 18:59:57 +0200
commita92d89d3fcc826cd0a7164201c6f25f756fd9afc (patch)
treeb8d93e022db780b4346714c5fea4b5dcc5097d73
parentf4c4fde673b21d248e5f472543568b72ade2105e (diff)
edit-in-place operations now require an additional --edit-in-place flag
-rwxr-xr-xbin/pyggle25
1 files changed, 23 insertions, 2 deletions
diff --git a/bin/pyggle b/bin/pyggle
index 07b778a..dbccd55 100755
--- a/bin/pyggle
+++ b/bin/pyggle
@@ -549,6 +549,11 @@ if __name__ == "__main__":
help="Store captions as EXIF comments (IN-PLACE EDIT)",
)
parser.add_argument(
+ "--edit-in-place",
+ action="store_true",
+ help="Enable options that edit images in-place",
+ )
+ parser.add_argument(
"--exif-copyright",
metavar="STRING",
type=str,
@@ -598,6 +603,18 @@ if __name__ == "__main__":
args = parser.parse_args()
+ if (
+ args.caption_to_exif
+ or args.exif_copyright
+ or args.resize
+ or args.scrub_metadata
+ ) and not args.edit_in_place:
+ print(
+ "in-place edit option used without --edit-in-place, aborting",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
base_dir = "/".join(os.path.realpath(sys.argv[0]).split("/")[:-2])
copy_files(f"{base_dir}/share")
@@ -629,7 +646,11 @@ if __name__ == "__main__":
)
thumbnails.append(thumbnail)
- if args.resize and (im.size[0] > args.resize or im.size[1] > args.resize):
+ if (
+ args.edit_in_place
+ and args.resize
+ and (im.size[0] > args.resize or im.size[1] > args.resize)
+ ):
subprocess.run(
[
"mogrify",
@@ -658,7 +679,7 @@ if __name__ == "__main__":
]
)
- if exiftool_args:
+ if args.edit_in_place and exiftool_args:
subprocess.run(
[
"exiftool",