pythonimagepython-2.7meta-tags

Edit Meta Data of Image Python


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?


Solution

  • 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.