Recent Posts

Pages: [1] 2 3 ... 10
Excellent, good to hear it worked out. (I see you used the $(“code”) variant of the backtick operator, good!)
Developers / Re: Read and Copy Exif data to multiple images Matlab
« Last post by Hayo Baan on Today at 11:38:53 AM »
No need for loops :) To copy metadata from existing images in different directories can all be done with a single exiftool command:
Code: [Select]
exiftool -tagsfromfile F:\%f.%e -ext JPG F:\CorThis will copy the metadata from the files in F:\ to the files in F:\Cor for all files in F:\Cor.
Or isn't this what you wanted?
Developers / Read and Copy Exif data to multiple images Matlab
« Last post by christinak on Today at 09:19:15 AM »

First of all I am sorry if this is answered somewhere else but I couldn't find a solution.
I am quite new to programming and also to Matlab so if this can be done in Python for example, feel free to give me a push (however I am not sure on how to run exiftool from python).

My problem:
When pre-precessing images in Matlab and using imwrite to save the output, all the metadata from the original images are lost.
I used exiftool from command prompt and saw that it can successfully copy and paste the metadata from one image to another but I need to run it in like for like 1000 of images so its not possible to specify the names and paths everytime.
So I need to create a small loop with exiftool that can 1. read per input image all the metadata and for the same name image on the output images and 3.copy the medatada.
So far I have something like that

Images = dir('F:\*.jpg'); %Initial images
CorImages = dir('F:\Cor\*jpg'); %Corrected images after pre-processing

for i=1:length (Images)
    im = imread( fullfile('F:\', Images(i).name ) );
    exifdata = getexif(im);
    for k=1:length (CorImages)
        cim = imread( fullfile('F:\Cor', CorImages(i).name) );
        if Images(i).name == CorImages(k).name
            status = putexif(cim); %apparently something missing here?

When I run this I get this error
Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Error in getexif (line 26)
TS=[ '"' test '" -s "' fname '"'];

I would appreciate any help..
Newbies / Re: Avoiding duplicate keywords?
« Last post by Phil Harvey on Today at 08:53:27 AM »
Hi Christian,

FAQ 17 explains how to do this.

- Phil
Hi Guys,

Thanks to some pointers from Hayo I was able to fix my problem. My script will now auto update the file names and sort them in year by month and if it is taken by my "Powershot"  it will put it in a new folder. all the DSLR files will remain in there old location. The whole code is found below. There are bit of old code still in there to copy directly from the DSLR, however this is not up and running yet!

Code: [Select]
# Test to see if $PhotosPath exists, if not promp for new path / exit.
#test -d $PhotosPath || read -p "$PhotosPath does not exist, close to exit or type new path:" PhotosPath
#test -d $PhotosPath || "read -p '$PhotosPath is invalid. Press enter to close' && exit"

#echo "Photo's will be copied from $CameraPath to sorting folder"
# move files for camera to $PhotosPath
#mv -v $CameraPath/* $PhotosPath/
#echo "Photo's will be copied from $PhotosPath to sorting folder"
# move files from camera to $SortPath
mv -v $PhotosPath/* $SortPath/

# rename all image files in $SortPath
# FolderDateDD-HHMMSS.ext
echo "Photo's will be renamed like: YYYYMMDD-OriginalFileName.*"
exiftool -progress '-filename<CreateDate' -d %Y%m%d-%%f.%%le -r -m $SortPath/*
#jhead  -autorot -ft -nf%Y%m%d-%H%M%S $SortPath/*

# Sort files into folders using $CharFromName letters of the file name
ls $SortPath | while read file; do
# find model name -s -s -s is for short name without tagname
 ModelName=$(exiftool -s -s -s -'Model' $SortPath/$file)
  # extract first $CharFromName characters from filename
if [ ${file:4:$CharFromNameMonth} -eq 01 ]
elif [ ${file:4:$CharFromNameMonth} -eq 02 ]
elif [ ${file:4:$CharFromNameMonth} -eq 03 ]
elif [ ${file:4:$CharFromNameMonth} -eq 04 ]
elif [ ${file:4:$CharFromNameMonth} -eq 05 ]
elif [ ${file:4:$CharFromNameMonth} -eq 06 ]
elif [ ${file:4:$CharFromNameMonth} -eq 07 ]
elif [ ${file:4:$CharFromNameMonth} -eq 08 ]
elif [ ${file:4:$CharFromNameMonth} -eq 09 ]
elif [ ${file:4:$CharFromNameMonth} -eq 10 ]
elif [ ${file:4:$CharFromNameMonth} -eq 11 ]
elif [ ${file:4:$CharFromNameMonth} -eq 12 ]
#only if file is from "Canon PowerShot SX260 HS" then make additional folder
if [ "$ModelName" = "Canon PowerShot SX260 HS" ]
 # create directory if it does not exist
 test -d $LibraryPath/$FolderYear/$FolderYear-$FolderMonth/"$ModelName"/ || mkdir -p $LibraryPath/$FolderYear/$FolderYear-$FolderMonth/"$ModelName"/
 # move the current file to the destination dir
 mv -v $SortPath/$file $LibraryPath/$FolderYear/$FolderYear-$FolderMonth/"$ModelName"/$file
 elif [ "$ModelName" != "Canon PowerShot SX260 HS" ]
 # create directory if it does not exist
 test -d $LibraryPath/$FolderYear/$FolderYear-$FolderMonth/ || mkdir -p $LibraryPath/$FolderYear/$FolderYear-$FolderMonth/
 # move the current file to the destination dir
 mv -v $SortPath/$file $LibraryPath/$FolderYear/$FolderYear-$FolderMonth/$file

# move sorted files into photo library
#mv -v $SortPath/* $LibraryPath/

# Umount the card
#umount $CameraPath

# End notification
echo "Photos  from: $PhotosPath"
echo "End location: $LibraryPath"
read -p "Press enter to close this window…"
Newbies / Avoiding duplicate keywords?
« Last post by chall_de on Today at 07:43:27 AM »

I'm a real beginner with ExifTool and I have the following problem:

I want to add the keyword "People" to an image but only if the keyword does not exist.
I have tried the following command but if I use it multiple I get duplicates.

exiftool -P "-keywords+=People" "E:\Test\0012.TIF"

How can I realize this?

Thanks in advance

Bug Reports / Feature Requests / Re: LayerNames Character Limitation
« Last post by Phil Harvey on February 18, 2017, 02:18:12 PM »
I haven't imposed a limit.  If you find a file that you believe contains more characters than ExifTool reports, please send it to me and I'll take a look (phil at

- Phil
Bug Reports / Feature Requests / LayerNames Character Limitation
« Last post by JUZZA on February 18, 2017, 11:48:18 AM »
Is there a character limit in the tool when getting layer names once the -LayerNames option because it appears to me it is only capturing a maximum of 31 characters.  I wondered if this was a Photoshop limitation but with version 14.2 and above it now supports up to 255 characters.

I discovered this by chance as I am using the tool to generate the relevant content I require for all Photoshop files within a folder.  I then read that text file in PHP and export the data into MySQL.  When I was checking the data in the database I could see some of it was missing.  I did some testing by creating some dummy layers with really long names and once exported it was only capturing a maximum of 31 characters.

System type: Windows 10
ExifTool version:
Command Line: exiftool.exe -filename -Description -TextLayerText -IngredientsFilePath -LayerNames -gpslatitude -gpslongitude -n -php "<FOLDERNAME>" > "<FOLDERNAME>\exifdata.txt"
I don't think the script handles wildcards in Windows (there is no automatic globbing of command-line arguments in Windows so the script would have to do this itself), so specify a directory name instead to process an entire directory of files.

- Phil
Excellent! It works for you as I had hoped. That it runs on and on is quite normal; long video files have MANY dates to changes (possibly hundreds), and this may take a LONG time. Just let it run and eventually it will have processed all files. If you want you can inhibit writing the _original files by adding -overwrite to the command line, but other than that everything looks good 😊
Pages: [1] 2 3 ... 10