Pages

Sunday, January 28, 2018

Script to copy Exif data from/to multiple images

Here is a simple script to copy the EXIF data from the images in one folder, to the images (with the same name) in another folder.

To use this script, you need the ExifTool by Phil Harvey (it's a very usefull free utility).

Here are the instruction:
  • Copy paste the script in a  .cmd file
  • Place the  .cmd file in the ExifTool folder
  • Customize the script (set the source/destination folder, and the source/destination file type)
Then run the script, to verify that it find the correct files.
It should output the name of the files that exists in both source and destination folder.

Finally:
  • Activate one of the 2 ExifTool command by removing one of the red rem
    • The first command wont copy the orientation tag
    • The second command will copy even the orientation tag
    • Check which one work best for you (and, anyway, never delete source material :-) )
  • Run the script again, to copy the ExifData


Here is the script:
 ===============================================================

@echo off

rem Find the script path
set scriptPath=%~dp0
set scriptPath=%scriptPath:~0,-1%


rem Source folder (images FROM WHICH you want to copy exif data)
set src=C:\SOURCE FOLDER

rem Source file type
set srcType=dng

rem Destination folder (images TO WHICH you want exif data to be copied)
set dst=C:\DESTINATION FOLDER

rem Destination file type
set dstType=jpg


rem Scan the source folder
FOR %%d IN ("%src%\*.%srcType%")  DO  (
    rem ECHO %%d
    rem ECHO %%~nd
   
    IF EXIST "%dst%\%%~nd.%dstType%" (
        ECHO %%d
        rem "%scriptPath%\exiftool.exe" -TagsFromFile "%%d" --Orientation "%dst%\%%~nd.jpg"
        rem "%scriptPath%\exiftool.exe" -TagsFromFile "%%d" "%dst%\%%~nd.
%dstType%"
    )
)

pause
 ===============================================================

No comments:

Post a Comment