Search code examples
c#.netgdi+exifexiftool

Ignore EXIF Orientation Tag from-TagsFromFile argument


I'm processing some images.Before processing I realign the image based on the orientation tag, process it and save it.After this process I copy all exif data using exiftool

 using (StreamWriter writer = new FileInfo(exifcommandpath + "exiftoolcommands.txt").AppendText())
 {

 writer.WriteLine("-TagsFromFile");
 writer.WriteLine(cpath);
 writer.WriteLine("--thumbnailimage");
 writer.WriteLine(outdir + "\\" + Path.GetFileNameWithoutExtension(cpath) + ext);
 writer.WriteLine("-overwrite_original");
 if (counter != Filelist.Count)
 {
 writer.WriteLine("-execute");
 }
 else
 {
 writer.WriteLine("-stay_open");
 writer.WriteLine("False");
 }
 }

But this produces wrongly oriented image.How can I selectively ignore the EXIF Orientation tag while copying? Please advice..


Solution

  • The answer is the exact same way already in your code to avoid copying ThumbnailImage, two hyphens in front of the tag you don't want to copy --Orientation.

    See --TAG in the exiftool docs.