I would like to call exiftool in Windows 7 from within a python script to both extract and add info to the image tags, but I'm stumbling over the basic workflow to do this. This question and answer addresses this topic, but I have a couple of basic questions regarding it and am unable to comment on the original question:
- Where on my system should the executable be stored?
- What does the *filenames bit do?
- Can I just specify a list of files in place of *filenames in the 'with ExifTool()' bit, or should I just leave it as is and make sure my directory with my images is my cwd?
Any help is appreciated!
The executable can be stored anywhere on your system - just make sure to pass the path to the ExifTool constructor when you create it:
with ExifTool('') as e: metadata = e.get_metadata(*filenames)
*filenames
is syntax for "exploding" a list (in this example). Rather than passing a single list with filenames to theself.execute
call, we pass all the filenames as part of the *args.You can specify a list of filenames if you want -
filenames
just needs to be a list of paths forexiftool
to process.