{"id":134,"date":"2010-03-31T20:13:37","date_gmt":"2010-04-01T00:13:37","guid":{"rendered":"http:\/\/blog.alanporter.com\/?p=134"},"modified":"2010-03-31T20:13:37","modified_gmt":"2010-04-01T00:13:37","slug":"photo-utility-renrot","status":"publish","type":"post","link":"https:\/\/alanporter.com\/blog\/2010\/03\/31\/photo-utility-renrot\/","title":{"rendered":"Photo utility &#8211; renrot"},"content":{"rendered":"<p>When I take pictures with my digital cameras, they name the image files something like this:<\/p>\n<ul>\n<li>Wife&#8217;s Nikon camera &#8211; <code>dscn0115.jpg<\/code><\/li>\n<li>My iPhone &#8211; <code>img_0367.jpg<\/code><\/li>\n<li>My Panasonic camera &#8211; <code>p1070126.jpg<\/code><\/li>\n<\/ul>\n<p>I tend to let the images pile up on the cameras for a while, and then I copy them all onto our file server. I start off by dumping them all into one big folder. But then I sort them into folders based on the date and the event, with names like &#8220;<code>pictures\/y2010\/2010-02-14_chinese_new_year<\/code>&#8221; for events and &#8220;<code>pictures\/y2010\/2010-02<\/code>&#8221; for the random shots. I don&#8217;t mind this process, and it&#8217;s actually kind of fun to review them as I am copying them to our file server.<\/p>\n<p style=\"padding-left: 30px;\">I should note as an aside, when I worked for Ericsson&#8217;s research lab in Singapore, I was talking to one of the researchers who had studied the many ways that people could organize and categorize photographs, both paper and digital. It turns out that a huge majority of people they studied tended to associate photo sets together, based on relative dates. That is, if you asked for a particular photo, they would think &#8220;that was about the same time as Bob&#8217;s birthday party, so it must have been in August&#8221;.<\/p>\n<p style=\"padding-left: 30px;\">I know that there are newer ways to organize photos, with databases and &#8220;tags&#8221; and what-not. Mac people really love to let the computer take care of those details. But I still like the idea of using folders with dates&#8230; <strong>old school<\/strong>.<\/p>\n<p>Since I am dealing with dates and times of photos, it seems a little silly that all of my photos are named using dumb serial numbers. I find myself looking at the image&#8217;s EXIF properties, the information that the camera stores about the image &#8212; when and where the image was taken, what the camera settings were, etc. This seems a little tedious.<\/p>\n<p>I recently found a utility called &#8220;renrot&#8221;. It&#8217;s primary job is to read the EXIF data from a photo, and rotate the image to match the EXIF rotation flag. That is, it rewrites the image so that it will load from top-to-bottom, which makes it more compatible with less-than-intelligent viewers &#8212; like some digital picture frames. But while it&#8217;s doing that, it also renames the file based on the time and date of when the photo was taken.<\/p>\n<p>So now I can start by going into the directory that contains my big pile of photos and doing this:<\/p>\n<pre>renrot --name-template %Y%m%d-%H%M%S --extension jpg *.JPG<\/pre>\n<p>If I wanted to be careful not to mix the iPhone pictures with the Nikon pictures, I could do this:<\/p>\n<pre>renrot --name-template iphone-%Y%m%d-%H%M%S --extension jpg IMG_*.JPG\nrenrot --name-template nikon-%Y%m%d-%H%M%S --extension jpg DSCN*.JPG\nrenrot --name-template pan-%Y%m%d-%H%M%S --extension jpg P*.JPG<\/pre>\n<p>If I want to be a purist, and just rename the photos without actually rotating the image, I can do that, too.<\/p>\n<pre>renrot --no-rotate --name-template %Y%m%d-%H%M%S --extension jpg *.JPG<\/pre>\n<p>Pretty cool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I take pictures with my digital cameras, they name the image files something like this: Wife&#8217;s Nikon camera &#8211; dscn0115.jpg My iPhone &#8211; img_0367.jpg My Panasonic camera &#8211; p1070126.jpg I tend to let the images pile up on the cameras for a while, and then I copy them all onto our file server. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,15],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-software","category-tips-tricks","count-0","even alt","author-alan","last"],"_links":{"self":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/comments?post=134"}],"version-history":[{"count":0,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/134\/revisions"}],"wp:attachment":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/media?parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/categories?post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/tags?post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}