Skip to main content
Laurent_D
Known Participant
May 28, 2021
Answered

Lightroom change la date de capture au moment de l'enregistrement de mots clés

  • May 28, 2021
  • 3 replies
  • 1719 views

Salut la communauté, j'ai bien vu les posts les plus proches de cette présente question mais je n'ai toujours pas de solution adaptée aux gros volumes à traiter.

 

J'utilise Lightroom pour taguer mes photos, ce qui me permet de les retrouver plus efficacement par la suite soit dans Windows, soit dans Moments (Synology), etc.

L'intérêt est donc que les mots clés soient enregistrés dans le champs correspondant de chaque photo.

Lorsque je demande à Lightroom d'enregistrer les changements, il enregistre les mots clés mais remplace aussi la date de capture par la date du jour.

Il existe des outils qui permettent de modifier la date mais lorsque l'on a des miliers de photos à des dates et heures différentes, cette solution n'est tout simplement pas adaptée.

 

Comment faire pour n'enregistrer que les métadonnées modifiées et non la date de capture qui n'a jamais été modifiée ?

Il n'est pas question ici d'export de nouveaux fichiers mais bien d'écriture dans les fichiers originaux.

 

Au plaisir de vous lire.

This topic has been closed for replies.
Correct answer johnrellis

"It's fortunate that each picture is properly named as follows : aaaammdd_hhmmss.jpg (for instance : 20210607_175459.jpg) So I need to find a script that writes the date/time from the name to the capture date."

 

One approach doesn't require programming: Export as a text file a list of all the file paths using the Any Filter, List View, or LR/Transporter plugins. 

 

1. Select all the photos and do Metadata > Save Metadata To File.

 

2. Use a text editor with regular expressions or Excel (if you're an Excel junky) to transform that list to a list of shell commands invoking the free Exiftool utility to set the files' EXIF:DateTimeOriginal field. E.g. given this line in the text file:

 

/users/john/pictures/20210607_175459.jpg

 

the text editor or Excel formula transforms it to this line:

 

exiftool -exif:datetimeoriginal="2021:06:07 17:54:59" "/users/john/pictures/20210607_175459.jpg"

 

3. Run that shell script / batch file.

 

4. With all the photos selected, do Metadata > Read Metadata From File.

3 replies

johnrellis
johnrellisCorrect answer
Legend
June 7, 2021

"It's fortunate that each picture is properly named as follows : aaaammdd_hhmmss.jpg (for instance : 20210607_175459.jpg) So I need to find a script that writes the date/time from the name to the capture date."

 

One approach doesn't require programming: Export as a text file a list of all the file paths using the Any Filter, List View, or LR/Transporter plugins. 

 

1. Select all the photos and do Metadata > Save Metadata To File.

 

2. Use a text editor with regular expressions or Excel (if you're an Excel junky) to transform that list to a list of shell commands invoking the free Exiftool utility to set the files' EXIF:DateTimeOriginal field. E.g. given this line in the text file:

 

/users/john/pictures/20210607_175459.jpg

 

the text editor or Excel formula transforms it to this line:

 

exiftool -exif:datetimeoriginal="2021:06:07 17:54:59" "/users/john/pictures/20210607_175459.jpg"

 

3. Run that shell script / batch file.

 

4. With all the photos selected, do Metadata > Read Metadata From File.

Laurent_D
Laurent_DAuthor
Known Participant
June 30, 2021

Hi @johnrellis 

I come back to give some feedback on the process.

I exported metadata using AnyFilter but as many of these plugins, the result doesn't keep the western european accents in the paths of the photos.

So now I only use a .bat file to extract what I need the way I need. Here is the process:

 

1_Lister.bat

chcp 65001 > null
exiftool -csv -m -r -L "-exif:datetimeoriginal" "-filemodifydate" %* > C:\Path\2_Listing.csv
pause

 

I drag and drop a folder containing many subfolders and pictures on this .bat file, then it creates/erases the following file:

2_Listing.csv

Which contains:

  • paths_with_accents\filenames.ext,
  • Capture date
  • Modified date.

 

Then I open my new automated best friend:

3_ListingToScript.xlsx

It imports the list from above .csv file,

then splits and filters data into columns:

  • Path,
  • File,
  • Capture date,
  • Modified date,
  • File name,
  • Extension,
  • Whether the file name is a date or not,
  • Date extracted from file name,
  • Time extracted from file name,
  • Date extracted from DateTimeOriginal (capture time),
  • Time extracted from DateTimeOriginal (capture time),
  • Whether the capture time is missing,
  • Delta between File name and capture time (can be relevant),
  • ExifTool batch command line (only if needed)

 

Then the ExifTool batch command lines are pasted on the following .bat file:

 

4_Script.bat

chcp 65001 > null
exiftool -exif:datetimeoriginal="2018:07:16 20:47:57 " "//server/homes/Path/20180716_204757.jpg
exiftool -exif:datetimeoriginal="2018:03:02 04:54:30 " "//server/homes/Path/20180302_045430.jpg
exiftool -exif:datetimeoriginal="2019:12:28 12:07:02 " "//server/homes/Path/20191228_120702.jpg

...

pause

 

I got 1981 lines at the first time.

Then I ran the 4_Script.bat and it did the job..

..sort of, I still need to fix a few date syntaxe bugs.

 

Best regards,

Laurent.

johnrellis
Legend
July 2, 2021

Thanks for the update on your process -- that will help others.

johnrellis
Legend
May 28, 2021

Google Translation: "Lightroom changes capture date when saving keywords. 

 

Hi community, I saw the posts closest to this question, but I still don't have a suitable solution for large volumes to process.

 

I use Lightroom to tag my photos, which allows me to find them more efficiently afterwards either in Windows, or in Moments (Synology), etc.

The advantage is therefore that the keywords are recorded in the corresponding field of each photo.

When I ask Lightroom to save the changes, it saves the keywords but also replaces the capture date with today's date.

There are tools that allow you to change the date but when you have thousands of photos at different dates and times, this solution is simply not suitable.

 

How to save only the modified metadata and not the capture date which has never been modified?

There is no question here of exporting new files but of writing to the original files."

johnrellis
Legend
May 28, 2021

It sounds like these photos are missing capture dates stored in their metadata. There are many reasons a photo may be missing a capture date, including: It came from a scanne or an old digital camera, or it was downloaded from an online service that stripped metadata from the photo.

 

When LR imports a photo that is missing capture date in its metadata, LR uses as its capture date the file's date-modified field that is maintained by the operating system.  The file's date-modified changes whenever any app changes the file for whatever reason.  When the date-modified changes, LR immediately notices and sets the photo's capture date in the catalog to that new date-modified.  (This is a horrible product design, but Adobe has never cared about supporting metadata of photos coming from other than modern digital cameras.)

 

So when you change the photo's keywords and then do Metadata > Save Metadata To File (or if you have set the option Catalog Settings > Metadata > Automatically Write Changes Into XMP), LR updates the photo's file with the new keywords and the operating system changes the file's date-modified to "now".  LR notices that and immediately changes the capture date recorded in the catalog to "now".

 

To work around this:

 

1. Make a backup of your catalog (better, make two backups).  LR doesn't let you undo changes to capture date.

 

2. Uncheck the option Catalog Settings > Metadata > Automatically Write Changes Into XMP.

 

3. Select all photos and do Metadata > Edit Capture Time. Immediately click Change All. 

 

These steps record the capture date currently displayed by LR for each photo into the photo's EXIF metadata (where digital cameras record it). Going forward, any changes to the photo won't cause the capture date to change.  Note that step 3 DOES NOT change all the photos to have the same date.

 

 

Laurent_D
Laurent_DAuthor
Known Participant
May 31, 2021

Thank you for your answer @johnrellis 

I will follow your advice and run some tests. Then I'll come with updates on this issue.

dj_paige
Legend
May 28, 2021

Please state clearly if you are using Lightroom or Lightroom Classic, and the version NUMBER.

 

Please state clearly your operating system version NUMBER.

 

 

Laurent_D
Laurent_DAuthor
Known Participant
May 28, 2021

Thank you for your answer @dj_paige

I'm using Lightroom Classic v.10.2 and Windows 10 v.19.09

Still this issue is the sams whatever version I'm using (earlier versions of Lightroom Classic and Windows 7)

dj_paige
Legend
May 28, 2021

In Windows 10, I see RAW files have not had their creation date changed when I add metadata via Lightroom. For JPGs, the creation date changes, but there is another field in Windows Explorer named "Date Taken", it doesn't show by default but it can be turned on, which does not change when you update the metadata.

 

I am curious, however, why this is an issue. In Lightroom Classic, the capture date does not change when you add metadata, and so photos are always searchable by capture date. In my opinion, I think all searching for photos should be done in Lightroom Classic, and so the issue goes away.