Created attachment 119615 [details] Date from filename option in "Adjust Time Date" tool SUMMARY I often find myself manually adding a date to pictures which have the date in the filename. For instance, pictures send through the WhatsApp messaging app have the following format: IMG-20110930-WA0000.jpg. Screenshots in Android look like this: Screenshot_20181013-182811~2. And profile pictures "Person Name 20170502_210305.jpg". As you can see, the date (and sometimes the time) can be inferred by the filename. So if you want to save that date to the file itself (since they do not have metadata due to privacy reasons), you can either do it manually or using exiftool with the following command: exiftool "-datetimeoriginal<filename" "/home/user/Pictures/IMG-20110930-WA0000.jpg" I actually use a simple bash script to do so, but it would be cool if the "Adjust Time Date" tool included an option to automatically extract the date from the filename in a flexible way, as exiftool does.
Git commit 9ebd1311087c1bcee0b24ef60a13f82bfc9f7128 by Maik Qualmann. Committed on 25/04/2019 at 21:35. Pushed by mqualmann into branch 'master'. try to get date from filename FIXED-IN: 6.2.0 M +2 -1 NEWS M +15 -0 core/dplugins/bqm/metadata/timeadjust/timeadjust.cpp M +29 -5 core/dplugins/generic/metadata/timeadjust/timeadjustdialog.cpp M +4 -0 core/dplugins/generic/metadata/timeadjust/timeadjustdialog.h M +64 -0 core/libs/timeadjust/timeadjustcontainer.cpp M +3 -0 core/libs/timeadjust/timeadjustcontainer.h M +24 -14 core/libs/timeadjust/timeadjustsettings.cpp https://invent.kde.org/kde/digikam/commit/9ebd1311087c1bcee0b24ef60a13f82bfc9f7128
Wow, already? I thought it would be quite complicated to implement. I'll try it in the next build. Thanks!
I found the idea interesting. Because through images of screenshots or WhatsApp and other programs such file names with date content occur more frequently. Current if there is no time, "00:00:00" is used. Another idea? Of course, a time can still be added in the tool. Maik
No, that's great. I had a phone which used the format "dd-mm-yy hhmm.jpg" (I think motorolas used to do that, with filenames like "08-11-05 2312.jpg") which can be confusing even for a human if you don't know the context. What happens in this case?
I also found that some nokia phones (e.g. nokia 6120c) used the format ddmmyyyy.jpg, which can also lead to confusion. For instance, I have this picture: 20072008(001).jpg, corresponding to July 20th, 2008, where (001), (002), etc. are used for successive pictures taken that day.
Yes, this format "dd-mm-yy hhmm.jpg" would not be recognized at this time. I'll add it tonight. This image "20072008(001).jpg" is not a problem. The attempt with "yyyyMMdd" would fail because the month is invalid. The match would be "ddMMyyyy". Maik
Git commit c0ee7dc6d208fb9afc4509479bb084559d39b566 by Maik Qualmann. Committed on 26/04/2019 at 22:11. Pushed by mqualmann into branch 'master'. add file name date format from Motorola phone M +20 -3 core/libs/timeadjust/timeadjustcontainer.cpp https://invent.kde.org/kde/digikam/commit/c0ee7dc6d208fb9afc4509479bb084559d39b566
For the sake of completeness, I've found that pictures taken with a Nokia C6-00 had this format: ddmmyyyy[xxx].jpg, such as: 01032012020.jpg, corresponding to the 1st of March, 2012, and the last there digits correspond to the number of pictures taken that day. That phone recorded Exif information in the pictures, so changing the date shouldn't be necessary, but just in case you wanted to test with this format.
Git commit b0f560f8982d67dea435f86762340941f58dee2b by Maik Qualmann. Committed on 28/04/2019 at 18:17. Pushed by mqualmann into branch 'master'. add case for date from filename M +2 -0 core/libs/timeadjust/timeadjustcontainer.cpp https://invent.kde.org/kde/digikam/commit/b0f560f8982d67dea435f86762340941f58dee2b
Sorry to interfere in this bug report ;) I have also old pictures without exif whose name contain the date, but the date format varies a lot. After a rapid research I have: yyyy_mmdd yyyy_mmdd_hhmmss dd_mm (no year) dd_mm yy etc... (I'm sure other users could easily add few more) Also if I have for 'dd_mm' e.g. 03_05, I wonder how you could automatically detect if the format is dd_mm or mm_dd ? So, instead of modifying the code each time a new file format is detected, it should be good if it was possible to manually tell what is the date format in the file name. E.g. a popup where you can manually enter the date template. Just an idea...
Git commit a11cbd3b7505187e23024d73c6532b41c9e0c56f by Maik Qualmann. Committed on 29/04/2019 at 20:39. Pushed by mqualmann into branch 'master'. add cases for date from filename M +9 -6 core/libs/timeadjust/timeadjustcontainer.cpp https://invent.kde.org/kde/digikam/commit/a11cbd3b7505187e23024d73c6532b41c9e0c56f
To support the variant without a year I do not see as meaningful. This should definitely remain an automatic function. I have a long list of test files, where you already think about which date is hidden behind it and yet the function recognizes the date correctly. You will certainly find a combination that is detected incorrectly. ((:-)) Maik
Hey, I've been playing with this new functions, and works great! It detected virtually all date formats I found in my pictures. Btw, one of the formats that could not detect, though, was the date used by early Android phones: "yyyy-mm-dd hh.mm.ss.jpg" (e.g.: 2009-11-07 00.50.29.jpg). Anyway, it's not really a problem because those pictures already included the date in the metadata.
Git commit 1251c037fec4499e0f9828b2bbf6acee23e0926c by Maik Qualmann. Committed on 03/05/2019 at 06:03. Pushed by mqualmann into branch 'master'. accepts the point as a time separator M +5 -4 core/libs/timeadjust/timeadjustcontainer.cpp https://invent.kde.org/kde/digikam/commit/1251c037fec4499e0f9828b2bbf6acee23e0926c
It's me again. I found two pictures whose date was not detected correctly from the filename: 14-09-04_1918.jpg -> 9/4/1918 0:00:00 14-09-04_1937.jpg -> 9/4/1937 0:00:00 I guess it automatically assumes that "19xx" is the year. Again, not a big deal.
https://invent.kde.org/kde/digikam/commit/1cb00166bc116696106780119db648416b73d10c Maik