I am taking a picture with opencv, and all of the image properties of the pictures it takes are not set. I need to set the camera make, model, and focal length. I am using python 2.7. I have looked at piexif, but that doesnt have the properties I need. Additionally I have looked at pyexiv2, however the pip install failed when I tried to install it for python 2.7. So how do I edit the meta data of an image in python?
Asked
Active
Viewed 602 times
0
-
1Your "question" does not contain a question. Please read [How to ask](https://stackoverflow.com/help/how-to-ask). – Mike Scotty Jan 19 '20 at 02:31
-
i thought the title was obvious. but theres an edit to clarify the question – figbar Jan 19 '20 at 02:37
-
1If your question is "how do I edit the meta data of an image", I personally would vote to close this as a dupe of https://stackoverflow.com/questions/52729428/ - however you claim that piexif does not support setting the fields you're looking for. But when I look into the [piexif code](https://github.com/hMatoba/Piexif/blob/master/piexif/_exif.py), it does seem those fields are supported (at least, I found Make, Model and FocalLength, but then again, I'm not very familiar with exif data, so I might be wrong, plus I cannot verify that piexif fully supports it, just by having it in the code). – Mike Scotty Jan 19 '20 at 02:51
-
3And if your question is about a recommendation of a different lib, then the question would be off-topic. That's why I linked [How to ask](https://stackoverflow.com/help/how-to-ask), because in my opinion, your question is still not specific enough to give a detailed answer. – Mike Scotty Jan 19 '20 at 02:52
-
2As an aside, why are you using Python 2? – AMC Jan 19 '20 at 03:12
-
I am using Python2 in order to link with other scripts in my projects which are all built in Python2.7, and are too complex to port to python3 – figbar Jan 19 '20 at 03:17
1 Answers
1
PyExifTool is a tiny Python wrapper library around Exiftool, which you can also call directly with subprocess.call
.
$ exiftool -Model='My camera' image.jpg
$ exiftool image.jpg
...
Camera Model Name : My camera
The parameters that you need are Make
, Model
, and FocalLength
. Full list of parameters are here.

oebilgen
- 41
- 4