CopyExif.Exe
Command Line Tool

Overview:

This tool takes a source image and destination image and adds any Exif data in the source image that is missing from the destination image.   I wrote this tool because someplace during my workflow of handling images I've been losing Exif data.  For any decent picture I keep the original raw formatted, and this tools, most of the time, will restore the missing data to the final image that I end up posting.  I did not have a significant problem until I started using Digital Photo Pro from Canon, for canon raw cr2 files, which habitually strips the exif information off before producing a JPG.

Notes:

  • The input files can be canon CR2 or JPG.
  • The output files must be JPG
  • Currently the output files must be encoded with Intel little ordering or the tool can't correct the Exif information in the output file. 
    • I'm half tempted to add a command line option that says trash the big endian formed data and replace it, but alas I only have a small percentage of files that suffer from this so I have not made the coding change (yet).  I'm going to first see if I can find the tool that doing this and see if there's a way to make it stop.
  • If you supply directory names instead of filenames, the tool will look for all matching JPG files in the destination directory and compare each one.  E.g., you can fix a batch of JPG files at once.
    • There is a special case of ".." that can be used on the destination name.  This will tell the app to check for matching destination JPG images in the parent directory of where the current source image is located.  I did this because that's the way I have some very large photo database setup.
       
  • No warranties are implied.  The tool is primarly made to correct files coming out of Digital Photo Pro and that's what it does.  If it works somewhere else great, if not.. maybe it can be extended but remember the price was free :).
     
  • Note that Exif encoding sort of sucks.  Many fields are position dependant, and to add back what's missing things must move, so if you don't understand some position dependant field it's rather hard to move it.   The tool handles the ones I've encounter.
     
  • Feel free to make fixes to the source code and email them back to me for inclusion so others may benefit as well.

 

Usage:



CopyExif  [-ruox] [-v1..f] Source Destination
 
Source The source image file, or source directory.
Destination The destination image file, or destination directory
   
-r Used when supplying a Source & Destination directory.  Recursively walks the Source directory looking for images, and checks the matching directory tree in the Destination directory looking for target JPGs to fix.
-u The default operation will only add missing Exif data items to the target image.  This flag causes Exif items that are in the target image to be replaced if the have a different value in the source image.
-o Overwrite all.  Causes Exif data items in the target to be removed that are not present in the source image.  
-t Removes the embedded jpg thumbnail in the target image.   (The tools I'm using aren't using them, so might as well pull them out).
-s Save the original JPG file.  This leaves the original JPG in a file with the extension of ".old"
-x Don't perform any updates.  Just scan and show what would be done.
-v1..f Sets the verbose flag to the hex value. 

Examples:

Copy Exif info from IMG_123.CR2 to IMG_123.JPG

CopyExif img_123.cr2 img_123.jpg

 

Copy Exif info from IMG_123.CR2 to IMG_123.JPG, and see what's happening

CopyExif -vf img_123.cr2 img_123.jpg

 

Copy Exif info from IMG_123.JPG to IMG_123.JPG

CopyExif original\img_123.cr2 post\img_123.jpg

 

Copy Exif info from all the files in the folder original to the matching files in the folder post

CopyExif original post

 

Copy Exif info from all the files in the folder-tree original to the matching files in the folder-tree post, remove all the embedded jpg thumbnails at the same time.

CopyExif -r -t original post

 

Download:

CopyExif Release 0.8
Windows 32 bit Binary and C++ Source Code
Approx Size 225KB

 


Return to top page

Page hits: 11,822