I'm trying to extract an xml blob in the header data from an image with the following code (a real stab in the dark):
import exifread
Open image file for reading (binary mode)
open('img.jpg', 'rb')
tags = exifread.process_file(f)
for tag in tags.keys():
if tag not in ('JPEGThumbnail', 'TIFFThumbnail', 'Filename', 'EXIF MakerNote'):
print ("Key: %s, value %s") % (tag, tags[tag])
print(tags)
however I get the following message:
==== RESTART: C:/Users/richie/Desktop/work/exif_read4.py ============
{}
>>>
I know the file contains data in the header, but its possible its not in exif format. Below is an example of the info as they appear in Imagej:
[JpegComment] Jpeg Comment: <?xml version="1.0" encoding="utf-8"?>
<image time="15:27:56.763207" date="2016.02.03" acq_index="3692">
<acquisition>
<exposure>10000</exposure>
<sensor_digital_gain>4</sensor_digital_gain>
<aperture>4</aperture>
<focus>68</focus>
<digital_gain>1</digital_gain>
<name>Photo_pose</name>
<camera_session_name>EXI-55-retest-3</camera_session_name>
</acquisition>
<errors>
Can anyone think of a way of extracting this data?