Salil Tamboli Salil Tamboli - 1 year ago 85
Python Question

Getting Camera model information of an image using Python

I am working on python automation in which I have to collect the camera model (canon, Nikon etc.) information of an image. I searched a lot but I am getting only pixel resolution, size and other data of an image.
Is there any API or library in which we can find the camera related each and every information or a particular API which gives camera model information.?

Answer Source

The Python exifread library can be used to extract a lot of information from a JPG image, including the Image Make and Image Model, for example:

import exifread

with open(r"sample.jpg", 'rb') as f_jpg:
    tags = exifread.process_file(f_jpg, details=True)
    print tags['Image Make']
    print tags['Image Model']

This could display something like:


Note, I have not tested this with the latest version. It can be installed using:

pip install exifread
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download