[opensuse] Organize Your Digital Photos - exiftool and jhead
Listmates, I've been meaning to pass this snippet along. I believe it was Patrick that pointed me to exiftool some time back. Organizing you mass of digital pictures couldn't be any easier than with exiftool or jhead. Both available for openSuSE and, for your friends that don't use linux, each has a windows counterpart that runs from the command prompt. Many of you already know, but for those that don't, one of the biggest pains about digital cameras is organizing the hundreds or thousands of 103Z2987.jpg files into a meaningful file structure that allows you to find pictures when you need them. A filename like 103Z2987.jpg doesn't tell me anything about that photo except that it came from my wife's camera because I set her camera to create 103Z... files. What I want in a filename is information that tells me when the picture was taken that will sort in chronological order no matter what I am looking at them with. I like a filename of the form YYYY-mm-DD-HHMMSS.jpg. For example: 2009-01-27-165238.jpg That way, just by looking at the filename, I know exactly when that photo was taken. Both exiftool and jhead provide the perfect solution. They will read the exif data and rename the photos with the format you provide. (the format parameters are from strftime). exiftool is a bit more flexible because, not only will it rename for you, but it will move the resulting files to where ever you want them. I had thousands of files in an awkward directory structure partially created from digikam and partially created by copying the photos from the memory stick. With one basic command line, I was able to rename and reorganize everything into a logical structure by year, by months 1-12, and then by date and time in each month. Example: 2003 2004---- 01 02 03------- 2004-03-05-174331.jpg 2004-03-05-174522.jpg 2004-03-07-082311.jpg 04 .. 12 2005 ... 2009 The man page for exiftool is quite good (see the example section at the bottom) I used the following command to reorder everything into the directory structure above using the exif tag 'CreateDate' for the file name: exiftool -r '-FileName<CreateDate' -d \ /home/pictures/family_pictures/%Y/%m/%Y-%m-%d-%H%M%S.%%e \ year2004/*.jpg Basically, the command just says recursively read each .jpg file, get the 'CreateDate' (date picture was taken) and use that as the filename and then place the renamed picture in the /home/pictures/family_pictures/ directory, under the %Y (year) subdirectory it belongs in, then in the %m (month) subdirectory it belongs in, with the filename of %Y-%m-%d-%H%M%S (YYYY-mm-DD-HHMMSS) preserving the original extension (.%%e) The only issue I had was with the (-r) option not wanting to recursively descend into all subdirectories. Changing the filespec to */*.jpg would get me one additional level of subdirectories, so I ended up just issuing the command 8-9 times and changed the filespec information (dir1/*.jpg, dir2/*.jpg, etc.) to go through all my picture directories. (I actually wanted to do the first couple one-at-a-time just in case something went wrong) Of course, the find command or 'for i in $(ls)....' would automate the process. Also, don't forget the -i (ignore) option if you have directories you don't want reorganized. I had ../scaled directories in each of my photo directories where I had scaled images to 800x600 for the digital picture frame that I needed to ignore. Absolutely Amazing. I re-ordered just over 8,000 photos in a little less that 30 minutes. (that included reading the man page and messing around with the filespec) If you can get all the files in one command, I bet the 8,000 photos would have been done in less than 3 minutes total. I did a little more thorough write up that is available at: http://www.3111skyline.com/linux/photo-mgmt.php The page is done for exiftool and jhead, but I still have the gallery2 information to add. Just thought I would pass this along for the benefit of those that haven't found exiftool and jhead yet. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday January 28 2009, David C. Rankin wrote:
Listmates,
...
Many of you already know, but for those that don't, one of the biggest pains about digital cameras is organizing the hundreds or thousands of 103Z2987.jpg files into a meaningful file structure that allows you to find pictures when you need them.
A filename like 103Z2987.jpg doesn't tell me anything about that photo except that it came from my wife's camera because I set her camera to create 103Z... files. What I want in a filename is information that tells me when the picture was taken that will sort in chronological order no matter what I am looking at them with. I like a filename of the form YYYY-mm-DD-HHMMSS.jpg. For example:
2009-01-27-165238.jpg
I have to differ with this. File names cannot and should not contain metadata. It's the least capacious and accessible and the most limited place for such information, and a date alone is not likely to tell you much, especially for a day that was busy and on which you collected many photos. It's the same thing with file names. They're arbitrary and if you want to be able to find things, it has to be based on their content. Let you camera name the files whatever gibberish it wants. Use a proper image database program, local or Internet-based, to extract, catalog and enable searching.
... -- David C. Rankin
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Wednesday January 28 2009, David C. Rankin wrote:
Listmates,
...
Many of you already know, but for those that don't, one of the biggest pains about digital cameras is organizing the hundreds or thousands of 103Z2987.jpg files into a meaningful file structure that allows you to find pictures when you need them.
A filename like 103Z2987.jpg doesn't tell me anything about that photo except that it came from my wife's camera because I set her camera to create 103Z... files. What I want in a filename is information that tells me when the picture was taken that will sort in chronological order no matter what I am looking at them with. I like a filename of the form YYYY-mm-DD-HHMMSS.jpg. For example:
2009-01-27-165238.jpg
I have to differ with this. File names cannot and should not contain metadata.
Yeah, I agree. Metadata belongs somewhere else - in the inode, the exif data, extended attributes etc. -- /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 28 January 2009 2:16:19 pm Per Jessen wrote:
Randall R Schulz wrote:
On Wednesday January 28 2009, David C. Rankin wrote:
Listmates,
...
Many of you already know, but for those that don't, one of the biggest pains about digital cameras is organizing the hundreds or thousands of 103Z2987.jpg files into a meaningful file structure that allows you to find pictures when you need them.
A filename like 103Z2987.jpg doesn't tell me anything about that photo except that it came from my wife's camera because I set her camera to create 103Z... files. What I want in a filename is information that tells me when the picture was taken that will sort in chronological order no matter what I am looking at them with. I like a filename of the form YYYY-mm-DD-HHMMSS.jpg. For example:
2009-01-27-165238.jpg
I have to differ with this. File names cannot and should not contain metadata.
Yeah, I agree. Metadata belongs somewhere else - in the inode, the exif data, extended attributes etc.
And I suppose your mp3/ogg files are all named like astronomers name celestial bodies? ;) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday January 28 2009, Constantinos Maltezos wrote:
On Wednesday 28 January 2009 2:16:19 pm Per Jessen wrote:
Randall R Schulz wrote:
On Wednesday January 28 2009, David C. Rankin wrote:
Listmates,
...
Many of you already know, but for those that don't, one of the biggest pains about digital cameras is organizing the hundreds or thousands of 103Z2987.jpg files into a meaningful file structure that allows you to find pictures when you need them.
A filename like 103Z2987.jpg doesn't tell me anything about that photo except that it came from my wife's camera because I set her camera to create 103Z... files. ...
2009-01-27-165238.jpg
I have to differ with this. File names cannot and should not contain metadata.
Yeah, I agree. Metadata belongs somewhere else - in the inode, the exif data, extended attributes etc.
And I suppose your mp3/ogg files are all named like astronomers name celestial bodies? ;)
I don't know if you mean me or Per, but my MP3 files are named whatever someone else or some ripping software named them. I organize and acces them by their internal metadata alone. I never see the files. Why would I want to? Files are just a big pain in the ass. Naming them, finding them, losing them, inadvertently destroying them. And placing them in hierarchies, while enticing, is utterly inadequate for true organization of anything as complex as an individual's or an organization's information resources. The sooner file systems are buried (but not, of course, dead), the better off we'll all be. I think that was one of the principles of the Oxygen project, and I don't doubt will stumble back to it eventually. Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 28 January 2009 7:28:27 pm Randall R Schulz wrote:
Yeah, I agree. Metadata belongs somewhere else - in the inode, the exif data, extended attributes etc.
And I suppose your mp3/ogg files are all named like astronomers name celestial bodies? ;)
I don't know if you mean me or Per, but my MP3 files are named whatever someone else or some ripping software named them. I organize and acces them by their internal metadata alone. I never see the files. Why would I want to?
Files are just a big pain in the ass. Naming them, finding them, losing them, inadvertently destroying them. And placing them in hierarchies, while enticing, is utterly inadequate for true organization of anything as complex as an individual's or an organization's information resources. The sooner file systems are buried (but not, of course, dead), the better off we'll all be. I think that was one of the principles of the Oxygen project, and I don't doubt will stumble back to it eventually.
The file system may not be a /good/ database, but it's still a database. I personally have no problem working with files and I don't see a reason why I should stop. (That /is/ an invitation, by the way.) What difference does it make if I organize photos and music via file name or via some application? For instance, I love Amarok and love the way it organizes my music collection - but in some ways, it falls far short of the organizing I can do on the file system. Like say there is a group of songs by the same artist, but both the tags and the file names have different capitalization/punctuation/etc. for the band name. In Amarok, they're all listed as different artists while in the file system, they're all in the same directory. That's okay, I still want to fix them. For the file names, I can use "for" and "sed" on the same line to change all the names so that they are uniform. I go to Amarok to change the artist name there... and I have to do one song at a time. I know, this is a limitation of Amarok, not the system. But I'm limited to what the programs provide unless I use a database program which I am /not/ about to do for a task like this. The file system is /established/. There are many ways to work it and I don't have to wait for someone to pick up the ball. And I have songs by Willie Nelson in the same directory as one by Willie and Merle Haggard. I can't do that in Amarok without taking Merle's name out of the artist line. Again, a limitation in audio tags, not the system, but I still have to wait until someone does something about it and I can use it. By the way... for what it's worth, I trust myself at the command line as well as in a GUI file manager. I generally don't inadvertently destroy files. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
I don't know if you mean me or Per, but my MP3 files are named whatever someone else or some ripping software named them. I organize and acces them by their internal metadata alone. I never see the files. Why would I want to?
Then why do you rant at filenames also(!) containing some of the metainformation? For YOU it doesn't matter, and for others it might be helpful. If you don't like it, don't do it, but don't accuse others because they see things differently than you do - this is very bad style, IMHO. Pit -- Dr. Peter "Pit" Suetterlin http://www.astro.su.se/~pit Institute for Solar Physics Tel.: +34 922 405 590 (Spain) P.Suetterlin@royac.iac.es +46 8 5537 8507 (Sweden) Peter.Suetterlin@astro.su.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Constantinos Maltezos wrote:
On Wednesday 28 January 2009 2:16:19 pm Per Jessen wrote:
Yeah, I agree. Metadata belongs somewhere else - in the inode, the exif data, extended attributes etc.
And I suppose your mp3/ogg files are all named like astronomers name celestial bodies? ;)
Well, I don't have many of those, but my photo and video files are, yes. /Per -- /Per Jessen, Zürich -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Wednesday January 28 2009, David C. Rankin wrote:
Listmates,
I have to differ with this. File names cannot and should not contain metadata. It's the least capacious and accessible and the most limited place for such information, and a date alone is not likely to tell you much, especially for a day that was busy and on which you collected many photos.
It's the same thing with file names. They're arbitrary and if you want to be able to find things, it has to be based on their content.
Let you camera name the files whatever gibberish it wants. Use a proper image database program, local or Internet-based, to extract, catalog and enable searching.
... -- David C. Rankin
Randall Schulz
Point well taken, and to an extent, I agree, but picture files don't always reside in nice little directories only accessed by image database programs that automatically parse exif data for you and order the photographs by exif CreateDate. Sometimes photo files get copied for use in project a, or project b along with other photo files where the gibberish filenames are worthless and there is no automagical database program for exif parsing. Or what if the wife wants to copy birthday files to disk or email for prints. Again, gibberish filenames are completely useless. Telling her, "honey, just look at the picture in the database and copy down the filename and then go copy that from the server to disk" doesn't cut it either. Saying f:/family_pictures/2008/04 works just fine. Not to mention the control you gain from being able to manage or copy the photos from the command line, konqueror, windows explorer, etc.. For me, it was well worth the effort. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Wednesday January 28 2009, David C. Rankin wrote:
I like a filename of the form YYYY-mm-DD-HHMMSS.jpg. For example:
2009-01-27-165238.jpg
I have to differ with this. File names cannot and should not contain metadata. It's the least capacious and accessible and the most limited place for such information, and a date alone is not likely to tell you much, especially for a day that was busy and on which you collected many photos.
It's the same thing with file names. They're arbitrary and if you want to be able to find things, it has to be based on their content.
Let you camera name the files whatever gibberish it wants. Use a proper image database program, local or Internet-based, to extract, catalog and enable searching.
On this, how do you people backup your photos? I have dirs (made manually) with photos in them taken for different purposes: ie. Holiday_2008_12 ------> Aquarium ------> etc But other sessions are ongoing - like nature photos I categorize differently ie Nature ------> Landscapes ---------> Location1 ---------> Location2 ------> Bugs etc These dirs just grows as I add photos to it. Now... getting to backup - the first is easy to backup - just write once somewhere (DVD, externalHDD, whatever) The second is difficult unless you just dump the whole lot every time - but these dirs get BIG. Would be nice to have some app that can create a filelist of photos taken after a specific date; which Im sure can be done with exiftool/jhead? You can then feed this list to your favorite backup prog. Manne -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Manne Merak wrote:
On this, how do you people backup your photos?
The second is difficult unless you just dump the whole lot every time - but these dirs get BIG.
Just use rsync. I have switched from a hand-written backup script to rsync, and it is simply 1000 times better (conservative estimate). All you need is #!/bin/bash tobackup="/home/manne/pictures" # no trailing slash storage="/media/your_usbdisk/pic_backup" nice ionice -n7 rsync -av --delete -HAX "$tobackup" "$storage" A script like this does a backup of my homedir in <1 minute after the initial run. Regards nordi -- Spam protection: All mail to me that does not contain the string "suse" goes to /dev/null. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
nordi wrote:
Manne Merak wrote:
On this, how do you people backup your photos?
The second is difficult unless you just dump the whole lot every time - but these dirs get BIG.
Just use rsync. I have switched from a hand-written backup script to rsync, and it is simply 1000 times better (conservative estimate). All you need is
#!/bin/bash tobackup="/home/manne/pictures" # no trailing slash storage="/media/your_usbdisk/pic_backup" nice ionice -n7 rsync -av --delete -HAX "$tobackup" "$storage"
A script like this does a backup of my homedir in <1 minute after the initial run.
Regards nordi
Thanks, ok, almost there. How do I only get the diff files? The issue is I dont want to re-backup the old photos, just the ones after a specific date. Manne -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Thanks, ok, almost there. How do I only get the diff files? The issue is I dont want to re-backup the old photos, just the ones after a specific date. It will not re-backup stuff that is already in the backup. On the first run, it will of course copy everything. During the second run it will only copy files that where modified or newly created. So when running
Manne Merak wrote: this script twice, the second run should finish in a few seconds because it does almost nothing. That is also the reason why I can backup my entire $home in <1 minute: Rsync only copies modified files. If you have some of your data backed up somewhere else and don't want to rsync that, use the --exlude-from option. Also useful to prevent backing up browser caches or ~/.thumbnails. The --delete makes sure that files you have deleted on your harddisk will also get deleted in your backup, so that your backup matches exactly the state of your system. Regards nordi -- Spam protection: All mail to me that does not contain the string "suse" goes to /dev/null. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, 2009-01-28 at 13:33 -0600, David C. Rankin wrote:
Just thought I would pass this along for the benefit of those that haven't found exiftool and jhead yet.
Thanks, I save for possible future use. I'll pass along another "trick": you can have a lot of files, like photos, organized in any way, and the same bunch hardlinked to another set of names and directories using an altogether diferent method. The files are not duplicated, it doesn't need more space, it is just the directories and files names which are redone. So, you might have an structure with the original names, another with dates, another with travels, another with people... the hard thing is getting an script or something that creates the organization. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkmBB4gACgkQtTMYHG2NR9WfOQCeIxXWSa6Es6X2bJto87nDCOmm B/IAn0tP3SXs49ZoxNc2Zf2ioJ3OKjPx =dwI2 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos E. R. wrote:
On Wednesday, 2009-01-28 at 13:33 -0600, David C. Rankin wrote:
Just thought I would pass this along for the benefit of those that haven't found exiftool and jhead yet.
Thanks, I save for possible future use.
I'll pass along another "trick": you can have a lot of files, like photos, organized in any way, and the same bunch hardlinked to another set of names and directories using an altogether diferent method. The files are not duplicated, it doesn't need more space, it is just the directories and files names which are redone.
So, you might have an structure with the original names, another with dates, another with travels, another with people... the hard thing is getting an script or something that creates the organization.
-- Cheers, Carlos E. R.
Now that is a great idea as well. What prompted this now was my current push to get all 8000 files in my family gallery2 album. I know gallery 2 doesn't care what the names are, but the gibberish names drove me nuts every time someone would say, "Hey can you shoot me a copy of the picture from the lake last October?" I simply want to do: echo "here it is" | mail -s "the picture" address -a filename, done. So before I started putting everything in gallery, I wanted a good logical structure to deal with. Gallery2 essentially does exactly what you are talking about for photos on the local server. You have the option when adding photos to an album 'from local server' to check the file name and check create as link. Another great feature of gallery2. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (8)
-
Carlos E. R.
-
Constantinos Maltezos
-
David C. Rankin
-
Manne Merak
-
nordi
-
Per Jessen
-
Pit Suetterlin
-
Randall R Schulz