Hi,
I am trying to write a script to take the exif data from my Minolta alpha-7 files and write them into my scanned files.
I have everything mostly working and the script will pull the data from the Minolta text file and then write to the scanned images with standard items such as FNumber, AllDates but when it comes to writing something like MeteringMode and ExposureProgram nothing happens.
I have tested the same commands on the same files from the command line with Exiftool and they all work without issue so I can't see what I am doing wrong.
Perhaps PyExifTool only works on certain Exiftool tags? It is hard to tell as I get no error feedback from PyExifTool.
with exiftool.ExifTool() as et:
et.execute(b"-AllDates=" + datetime_full.encode('UTF-8'), scanned_filename) # This works
et.execute(b"-MeteringMode=" + exif_meter_mode.encode('UTF-8'), scanned_filename) # This does nothing
et.execute(b"-ExposureProgram=Manual", scanned_filename) # This also does nothing
et.execute(b"-FNumber=2.8", scanned_filename) # This works
Has anyone else had a similar issue?
Thanks for any help you can offer.
Jason
Hi Jason,
This is FAQ number 6 (https://exiftool.org/faq.html#Q6). Check the EXIF Tags documentation (https://exiftool.org/TagNames/EXIF.html) for valid values for these tags.
- Phil
Thanks for the quick reply Phil.
I went through FAQ 6 before asking the question as I had seen that mentioned before in the forums but I couldn't find anything that I thought related to my issue.
The tags appear to be all valid and work perfectly directly in Exiftool via the command line just not via PyExifTool.I tried the -n and # as that seemed related to the print conversion issue but no luck there either.
I'm no programming guru but have used Exiftool on the command line for many years without an issue so maybe I missing something very obvious here but I just can't see what it is.
Jason
I need more information because I can't see the values you are trying to write or the ExifTool warnings that are generated.
Also, it seems as if you are executing ExifTool for each separate tag you are writing. It is much more efficient to write all tags in a single execution.
- Phil
Edit: Oh. I can see the value you are writing for ExposureProgram (-ExposureProgram=Manual). This should work as long as pyexiftool isn't using -n in the command.
Quote from: Phil Harvey on June 28, 2020, 06:41:43 AMThis should work as long as pyexiftool isn't using -n in the command.
From the docs on PyExifTool
start() (http://smarnach.github.io/pyexiftool/#exiftool.ExifTool.start):
The process is started with the -G and -n as common arguments, which are automatically included in every command you run with execute().
So it should be
-ExposureProgram=1 instead.
Thanks Phil - Unfortunately there's no warnings generated from PyExifTool which makes it very hard to debug but Stargeek's method works so that's great news. With regards to the seperate lines for writing the exif data, that's only for my own clarity while I am testing as I have about 15 different pieces of Exif data to bring in from the Minolta data file. Once it's all working I'll put it all into one string as it should be.
Stargeek - Thanks so much, that works perfectly. I hadn't even looked at start() as I was using execute() but I now see that execute() is mentioned there too. I'm still not exactly 100% on why it works but as my python chops gets better hopefully it all becomes clearer. :)
Thanks again for everyone's help - it is much appreciated.
Jason