python – Is there a method to write metadata to an image in PyExifTool?
I used ExifTool‘s ‘-tagsFromFile’ to copy Exif metadata from a source image to a destination image from the command line. Wanted to do the same in a python script, which is when I got to know of PyExifTool. However, I didn’t find any command to copy or write to a destination image. Am I missing something? Is there a way I can fix this?
I found user5008949‘s answer to a similar question which suggested doing this:
import exiftool filename="/home/radha/src.JPG" with exiftool.ExifTool() as et: et.execute("-tagsFromFile", filename , "dst.JPG")
However, it gives me the following error:
Traceback (most recent call last): File "metadata.py", line 9, in <module> et.execute("-tagsFromFile", filename , "dst.JPG") File "/home/radha/venv/lib/python3.6/site-packages/exiftool.py", line 221, in execute self._process.stdin.write(b"n".join(params + (b"-executen",))) TypeError: sequence item 0: expected a bytes-like object, str found
Read more here: Source link