python-pyexiv2

import pyexiv2

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os.path, time

%matplotlib inline


IMG2 = "../.."+"/retroATL3/images/IMG_2399.JPG"
metadata = pyexiv2.ImageMetadata(IMG2)
metadata.read()
img = mpimg.imread(IMG2)
plt.imshow(img)
<matplotlib.image.AxesImage at 0x7fdf9daa1950>

png

metadata.exif_keys
['Exif.Image.DocumentName',
 'Exif.Image.ImageDescription',
 'Exif.Image.Make',
 'Exif.Image.Model',
 'Exif.Image.Orientation',
 'Exif.Image.XResolution',
 'Exif.Image.YResolution',
 'Exif.Image.ResolutionUnit',
 'Exif.Image.Software',
 'Exif.Image.DateTime',
 'Exif.Image.Artist',
 'Exif.Image.YCbCrPositioning',
 'Exif.Image.ExifTag',
 'Exif.Photo.ExposureTime',
 'Exif.Photo.FNumber',
 'Exif.Photo.ExposureProgram',
 'Exif.Photo.ISOSpeedRatings',
 'Exif.Photo.ExifVersion',
 'Exif.Photo.DateTimeOriginal',
 'Exif.Photo.DateTimeDigitized',
 'Exif.Photo.ComponentsConfiguration',
 'Exif.Photo.ShutterSpeedValue',
 'Exif.Photo.ApertureValue',
 'Exif.Photo.BrightnessValue',
 'Exif.Photo.ExposureBiasValue',
 'Exif.Photo.MeteringMode',
 'Exif.Photo.Flash',
 'Exif.Photo.FocalLength',
 'Exif.Photo.SubjectArea',
 'Exif.Photo.MakerNote',
 'Exif.Photo.SubSecTimeOriginal',
 'Exif.Photo.SubSecTimeDigitized',
 'Exif.Photo.FlashpixVersion',
 'Exif.Photo.ColorSpace',
 'Exif.Photo.PixelXDimension',
 'Exif.Photo.PixelYDimension',
 'Exif.Photo.SensingMethod',
 'Exif.Photo.SceneType',
 'Exif.Photo.ExposureMode',
 'Exif.Photo.WhiteBalance',
 'Exif.Photo.FocalLengthIn35mmFilm',
 'Exif.Photo.SceneCaptureType',
 'Exif.Photo.LensSpecification',
 'Exif.Photo.LensMake',
 'Exif.Photo.LensModel',
 'Exif.Image.GPSTag',
 'Exif.GPSInfo.GPSLatitudeRef',
 'Exif.GPSInfo.GPSLatitude',
 'Exif.GPSInfo.GPSLongitudeRef',
 'Exif.GPSInfo.GPSLongitude',
 'Exif.GPSInfo.GPSAltitudeRef',
 'Exif.GPSInfo.GPSAltitude',
 'Exif.GPSInfo.GPSTimeStamp',
 'Exif.GPSInfo.GPSSpeedRef',
 'Exif.GPSInfo.GPSSpeed',
 'Exif.GPSInfo.GPSDateStamp',
 'Exif.Image.ImageHistory',
 'Exif.Thumbnail.Compression',
 'Exif.Thumbnail.XResolution',
 'Exif.Thumbnail.YResolution',
 'Exif.Thumbnail.ResolutionUnit',
 'Exif.Thumbnail.JPEGInterchangeFormat',
 'Exif.Thumbnail.JPEGInterchangeFormatLength']
try:
        metadata['Exif.Image.Make']
except KeyError:
        metadata['Exif.Image.Make'] =  "20170202a"

print metadata['Exif.Image.Make'].value
Apple
metadata['Exif.Image.DateTime'].value
datetime.datetime(2016, 3, 5, 23, 41, 49)
print metadata['Exif.Image.ImageDescription'].raw_value
print metadata['Exif.Image.DocumentName'].value
Original Tobo board - description
FullSizeRender_1.jpg
tag.raw_value
'2016:08:09 09:23:46'
# Main related module
metadata['Exif.Image.Software'] = "tobo"
# Writing the description
metadata['Exif.Image.ImageDescription'] = "Original pulser board (tobo) - description"
# Type of info -- setup, capture, description, ...
metadata['Exif.Photo.MakerNote'] = "photo description"
# Original filename
metadata['Exif.Image.DocumentName'] = IMG2.split("/")[-1]
# Author
metadata['Exif.Image.Artist'] = "kelu124"
# Type of info -- brief of project
metadata['Exif.Image.ImageHistory'] = "Coming from a project aiming at open-sourcing ultrasound imaging hardware - see https://kelu124.gitbooks.io/echomods/content/"
metadata.write()
for key in metadata.exif_keys:
    print key + " --> "+str(metadata[key].value)
Exif.Image.DateTime --> Mon Oct 17 13:36:36 2016




ImgSrc ="/include/community/WillT/industrialsensors.png"
if ("/include/community/" in ImgSrc):
    Author = ImgSrc.replace("/include/community/","")
    AuthorName = Author.split("/")[0]
    print AuthorName
else:
    AuthorName = "kelu124"
print AuthorName
WillT
WillT


results matching ""

    No results matching ""