MATLAB Answers

missing functionality when using imfinfo instead of exifread

93 views (last 30 days)
Sian on 7 Aug 2014
Commented: Sian on 7 Aug 2014
I use the function exifread in a script and get the warning:
EXIFREAD will be removed in a future release. Please use IMFINFO instead.
However, the information I want from the exif tag is the Orientation of the camera, which appears as a field with exifread but doesn't seem to be gathered by imfinfo. In fact, imfinfo has significantly fewer (and different) fields (see below). Could anyone shed some light on this? Why is some functionality being removed with the soon to be deprecated exifread? Is there a function to get an exhaustive exif read out?
Thanks for your help!
imfinfo =
Filename: '~'
FileModDate: '07-Aug-2014 09:55:22'
FileSize: 911121
Format: 'jpg'
FormatVersion: ''
Width: 4272
Height: 2848
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}
exiftag =
SceneCaptureType: 0
WhiteBalance: 0
ExposureMode: 1
CustomRendered: 0
FocalPlaneResolutionUnit: 2
FocalPlaneYResolution: 4.7866e+03
FocalPlaneXResolution: 4.7204e+03
PixelYDimension: 4272
PixelXDimension: 2848
ColorSpace: 1
FlashpixVersion: '0100'
SubSecTimeDigitized: '05'
SubSecTimeOriginal: '05'
SubSecTime: '05'
UserComment: [1x255 char]
FocalLength: 50
Flash: 16
MeteringMode: 5
ExposureBiasValue: 0
ApertureValue: 5.6250
ShutterSpeedValue: 5.6250
ComponentsConfiguration: [1 2 3 0]
DateTimeDigitized: '2014:05:14 15:55:54'
DateTimeOriginal: '2014:05:14 15:55:54'
ExifVersion: '0230'
ISOSpeedRatings: 100
ExposureProgram: 1
FNumber: 7.1000
ExposureTime: 0.0200
Copyright: ''
YCbCrPositioning: 2
Artist: ''
DateTime: '2014:06:04 17:20:19'
Software: 'Microsoft Windows Photo Viewer 6.2.9200.16384'
ResolutionUnit: 2
YResolution: 72
XResolution: 72
Orientation: 1
Model: 'Canon EOS 1100D'
Make: 'Canon'
Thumbnail: [1x1 struct]


Sign in to comment.

Accepted Answer

Friedrich on 7 Aug 2014
Edited: Friedrich on 7 Aug 2014
what MATLAB version are you using? Normally the returned structure of iminfo should have a field called DigitalCamera which contains the EXIF information.
In R2014a I get something like this:
>> info = imfinfo('img_1771.jpg')
info =
Filename: 'C:\Users\fhempel\Desktop\tmp\img_1771.jpg'
FileModDate: '07-Aug-2014 12:09:45'
FileSize: 32764
Format: 'jpg'
FormatVersion: ''
Width: 480
Height: 360
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}
Make: 'Canon'
Model: 'Canon PowerShot S40'
Orientation: 1
XResolution: 180
YResolution: 180
ResolutionUnit: 'Inch'
DateTime: '2003:12:14 12:01:44'
YCbCrPositioning: 'Centered'
DigitalCamera: [1x1 struct]
ExifThumbnail: [1x1 struct]
>> info.DigitalCamera
ans =
ExposureTime: 0.0020
FNumber: 4.9000
ExifVersion: [48 50 50 48]
DateTimeOriginal: '2003:12:14 12:01:44'
DateTimeDigitized: '2003:12:14 12:01:44'
ComponentsConfiguration: 'YCbCr'
CompressedBitsPerPixel: 5
ShutterSpeedValue: 8.9688
ApertureValue: 4.6563
ExposureBiasValue: 0
MaxApertureValue: 2.9709
MeteringMode: 'CenterWeightedAverage'
Flash: 'Flash did not fire, no strobe return detection function, auto flash mode, f...'
FocalLength: 21.3125
MakerNote: [1x450 double]
UserComment: [1x264 double]
FlashpixVersion: [48 49 48 48]
ColorSpace: 'sRGB'
CPixelXDimension: 2272
CPixelYDimension: 1704
InteroperabilityIFD: [1x1 struct]
FocalPlaneXResolution: 8.1143e+03
FocalPlaneYResolution: 8.1143e+03
FocalPlaneResolutionUnit: 2
SensingMethod: 'One-chip color area sensor'
FileSource: 'DSC'
CustomRendered: 'Normal process'
ExposureMode: 'Auto exposure'
WhiteBalance: 'Auto white balance'
DigitalZoomRatio: 1
SceneCaptureType: 'Standard'


Sian on 7 Aug 2014
Hi Friedrich, thanks! Unfortunately I can't share the file. But your answer made me realise that the file I was trying to extract exif info from was a copy of the original (copied in Windows explorer). When I imfinfo the original, I can see all the data in the DigitalCamera field. I didn't realise that you lose a lot of exif info when copying images in Windows explorer. I guess the next question is how to copy images without losing the exif information... :)
Friedrich on 7 Aug 2014
When I copy my small example file around all the information stay. So I don't loose the EXIF info on my machine.
Sian on 7 Aug 2014
Hmm that's odd, I tried the copying operation again and wasn't able to recreate the error... there must be another problem in the pipeline, I will figure it out. Thanks very much for your help!

Sign in to comment.

More Answers (0)

Translated by