Announcement

Collapse
No announcement yet.

Edit EXIF info without changing file date?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Edit EXIF info without changing file date?

    I have thousands of digital pix. Most cameras these days default-name jpeg pix with date and time. That way, an alphabetic sort also gives a date sort. As many of my pix predate that convention (and my Sony camera that I still have does not follow that naming pattern), I sometimes need to sort a mixed directory of pictures taken with different devices by true date order. If the file save date matches the original date the picture was taken, then all is good.

    However...

    I now need to edit the EXIF information on a bunch of old pictures before I forget what they were about. Editing EXIF information ordinarily involves changing the file save date as well.

    Is there a way to modify EXIF information yet still EASILY preserve the original timestamp on the file?

    I know that I can take note of the original timestamp, then use touch to 'put it back again' after the modification, but MAN, is that ever a lot of work!

    My primary photo organizer is DigiKam.

    Thanks.

    Frank.
    Last edited by Frank616; Oct 22, 2019, 09:42 AM.
    Linux: Powerful, open, elegant. Its all I use.

    #2
    Such a question was asked seven years ago, and the answers might lend some insight into what you want. See https://unix.stackexchange.com/quest...amp-after-edit
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      You don't say how you're editing the exif data or what of the data is being edited.

      If you use exiftool, the "-P" option preserves the file system date.

      A script that uses exiftool to sets your info using the -P option would do it.

      Also you said these files aren't named the same as your others. Why not rename them using their file dates, then not worry about the date stamp?

      Finally, you could dump the date/time stamps to a file and reset them after.

      Using exiftool:
      Code:
      stuart@yoga730:~/Pictures$ ll LenovoWallPaper.jpg
      -rw-rw-r-- 1 stuart stuart 5083718 May 14 16:18 LenovoWallPaper.jpg
      
      stuart@yoga730:~/Pictures$ exiftool "LenovoWallPaper.jpg" |grep -i date
      File Modification Date/Time     : 2019:05:14 16:18:22-04:00
      File Access Date/Time           : 2019:10:22 19:25:43-04:00
      File Inode Change Date/Time     : 2019:10:22 19:24:05-04:00
      Modify Date                     : 2018:04:28 10:04:07
      
      stuart@yoga730:~/Pictures$ exiftool -P -CopyrightNotice="2019 Still Oshunluvr" "LenovoWallPaper.jpg"  
          1 image files updated
      
      stuart@yoga730:~/Pictures$ exiftool "LenovoWallPaper.jpg" |grep -i right
      Copyright Notice                : 2019 Still Oshunluvr
      
      stuart@yoga730:~/Pictures$ exiftool "LenovoWallPaper.jpg" |grep -i date
      File Modification Date/Time     : 2019:05:14 16:18:22-04:00
      File Access Date/Time           : 2019:10:22 19:31:20-04:00
      File Inode Change Date/Time     : 2019:10:22 19:31:20-04:00
      Modify Date                     : 2018:04:28 10:04:07
      
      stuart@yoga730:~/Pictures$ ll LenovoWallPaper.jpg
      -rw-rw-r-- 1 stuart stuart 5083762 May 14 16:18 LenovoWallPaper.jpg

      Please Read Me

      Comment


        #4
        Originally posted by Snowhog View Post
        Such a question was asked seven years ago, and the answers might lend some insight into what you want. See https://unix.stackexchange.com/quest...amp-after-edit
        Cool! Thanks!
        Linux: Powerful, open, elegant. Its all I use.

        Comment


          #5
          Originally posted by oshunluvr View Post
          You don't say how you're editing the exif data or what of the data is being edited.
          DigiKam. I am just adding titles and comments.

          If you use exiftool, the "-P" option preserves the file system date.

          A script that uses exiftool to sets your info using the -P option would do it.
          I'll look into that.

          Also you said these files aren't named the same as your others. Why not rename them using their file dates, then not worry about the date stamp?
          Yes, I had thought about that too. And that may be the ultimate solution as it would also be impervious to accidental changes to the file that would lose the original timestamp. I may be back for a suggestion on how to do that in a batch file. I know the basics of doing stuff like that, but I may need some handholding when it comes time to actually write the batch file.

          Thanks, all, for the suggestions. I'll make a decision and try to implement the most practical one for me.
          Linux: Powerful, open, elegant. Its all I use.

          Comment


            #6
            Originally posted by Frank616 View Post
            ... the ultimate solution as it would also be impervious to accidental changes to the file that would lose the original timestamp. I may be back for a suggestion on how to do that in a batch file...
            Part of me thought, "challenge accepted", so here's a couple of one liners. To record the timestamps, run this in the top level directory, say ~/Pictures:
            Code:
            find * -type f -exec stat --format='%y %n' '{}' ';' > timestamps
            You might want to run this anyway. (Better would be to be using btrfs, and just take a snapshot, but if you are you already know that.) Note that if you move stuff around as part of the exercise, the path recorded in the file will be old.

            To apply them later:
            Code:
            while read stamp;do t=${stamp:0:35};f=${stamp:36};touch --date="$t" "$f";done < timestamps
            Trying the obvious approach to record the times using ls -l was really messy; ls is too oriented for interactive use, and it would have to be done separately in each directory.
            Regards, John Little

            Comment

            Working...
            X