Search code examples
imagematlabtiffexif

Extract Exif data from Tif


i have this code here and i would like to make it simpler by not using tif and cr2. basicly i would like to get exposure time fnumber iso and the date from the tif as variables t f S date, so that i don't have to use the cr2 file. here is my code so far:

clear all % clear workspace
RGB = imread('IMG_0069.tif');

info = imfinfo('IMG_0069.CR2'); % get Metadata
C = 1; % Constant to adjust image

x = info.DigitalCamera; % get EXIF
t = getfield(x, 'ExposureTime');% save ExposureTime
f = getfield(x, 'FNumber'); % save FNumber
S = getfield(x, 'ISOSpeedRatings');% save ISOSpeedRatings   
date = getfield(x,'DateTimeOriginal'); % save DateTimeOriginal

I = rgb2gray(RGB);

Solution

  • You can easily concatenate strings to from names.

    fname='IMG_XXX'; 
    imread([fname, '.tif']);
    iminfo([fname,'.CR2'])
    

    iminfo should give you any info encoded in the metadata, but from the comments I can see that your files have not the information you want.