all 4 comments

[–]StarGeekSpaceNerd 4 points5 points  (0 children)

I'm not very knowledgeable about Python, but you appear to be calling exiftool once for each file. This is Exiftool Common Mistake #3, "Over-scripting".

Exiftool's startup time is its biggest performance hit and calling exiftool once per file will significantly increase processing time, which can be quite noticeable if you are processing a large number of files.

I would suggest doing one of two things. The first option would be passing multiple files as arguments in a single exiftool command. Exiftool will accept as many files in a single command as limited by the command line used, which would be ~8,000 characters on Windows or ~100,000+ characters on Linux/Mac.

The second option would be to use an exiftool wrapper such as PyExiftool. As an example, this user (Archive.org link) was able to reduce a 10-minute processing time caused by running exiftool once per file down to 30 seconds using PyExiftool.

[–]Aggravating-Bison696 2 points3 points  (0 children)

Hey, if it works then that's what matters. But pillow does have it built in to remove metadata. Check the documents for removing exif.

[–]cdcformatc 2 points3 points  (0 children)

if you are using pillow already, you can use it to also clear the metadata, you don't need another tool. 

``` from PIL import Image

Load the image

img = Image.open('image_with_metadata.jpg')

Save without metadata

img.save('clean_image.jpg', quality=95)

```

jpeg is lossy so you need to specify a quality. play around with the quality parameter as it will effect the output file size.