From 84cc66b658b63707339a67544d92355ea789d9d1 Mon Sep 17 00:00:00 2001 From: Davide Cazzin <28535750+NeverMendel@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:39:23 +0200 Subject: [PATCH] Export EXIF metadata (#9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- Co-authored-by: Florian Schüller --- heif_convert/__main__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/heif_convert/__main__.py b/heif_convert/__main__.py index 8231eca..8380156 100644 --- a/heif_convert/__main__.py +++ b/heif_convert/__main__.py @@ -46,6 +46,13 @@ def parse_args(): help="output quality, integer [0, 100] (default: 90)", default=90, ) + parser.add_argument( + "-n", + "--no-exif", + dest="exif", + action="store_false", + help="Do not include EXIF metadata in the converted image", + ) parser.add_argument( "-v", "--verbose", @@ -119,7 +126,10 @@ def main(): output_filename, ) logging.info(f"Writing {output_filepath}") - image.save(output_filepath, quality=args.quality) + if args.exif: + image.save(output_filepath, quality=args.quality, exif=image.getexif()) + else: + image.save(output_filepath, quality=args.quality) print(f"Wrote {output_filepath}")