Sorting pictures

December 21, 2015 by · Leave a Comment
Filed under: Photography, SmartPhones & PDAs, Technology 

I’ve been backing up my iPhone photos to my Windows 10 desktop using Microsoft’s OneDrive.  The photos are on my local drive as well as the cloud.  The downside is that all the photos, movies, and screen shots are dumped into a single directory, and there are a lot of them.

I prefer to have them sorted by date into directories.  A directory for each year, with sub-directories for each month.  I could do this by hand, but that’s a pain, and I have to remember to do it on a regular basis.  Plus I’ll probably want to do the same for my wife’s iPhone photos.  So I decided to write a python script to scan the camera roll directory, and copy the files to a directory in my photo archive section.  The scrip will create directories if needed and skip files that are already in place.

That part was pretty straight forward. I used os.chdir() to get to source directory and os.listdir() to get the directory contents.  Don’t want to create month directories for directories, just files, so I used os.path.isfile() to filter out non-files, and then check the file extension.  I only want jpg, mov, png, and tiff files.  I use Camera+ most of the time, which produces tiff files instead of jpg files. The png files are screenshots.

I used os.stat() to get the create time, and found files I exported to the camera roll from Camera plus had a create time of when they were exported, not the time the photo was taken. (Once I started having Camera+ dump straight to the camera roll, I didn’t have this problem).

So, I dug a little deeper and found I could get an image created time stamp with a getImageDate() call.  Downside was this didn’t work for png, tiff, or mov files.   So I had to do some extra sorting, and wrote another function to use on just the jpg files. I called the open() function from the Image library, and extracted the exif data using the _getexif() function. This works most of the time, so when it fails I had it return a ‘?’ rather than the time stamp string.  Seeing that caused a fall back to the getImageDate() function.

This extra call to the Image library made the placement of the files more accurate.  I had the base time function return the month as a three character string and the year as a 4 characters string.  This required some basic string manipulation. Those two parameters were added to predetermined destination and passed to a function I had written for another project that checks if directory exits, and creates it if it does not.

Next was to have the program check to see if the file already existed in the correct destination directory.  If it did, don’t bother copying it again. This will make the incremental runs faster and save on unneeded file transfers.

Now I have a functional script that I can set up to automatically run once a week.  Once the files are archived off OneDrive, I can removed them there and on the iPhone is order to free up space.

Originally posted to Urbin Technology.  I put the source code for the time stamp functions there.

Cat in a Box

July 3, 2012 by · Leave a Comment
Filed under: Photography 

I’m pretty sure Amazon doesn’t deliver kittens, yet…

Saint Bernard Keg

June 13, 2012 by · Leave a Comment
Filed under: Photography 

One of my sons got a Saint Bernard, so I had to get a keg for the beast.

The son in question is a Helicopter pilot, the sticker was his idea.

Originally posted at the Slices of Life blog

Sunday SciFi: Star Trek Weapons

 
 Yes, I own both of those.  No problem with Geek Cred here.

This is the same image I have loaded on flicker, just punched it up a bit.

Statue of George Washington

July 4, 2011 by · Leave a Comment
Filed under: American History, History, Photography 

A statue of George Washington in the National Museum of American History. Done in the classic Greek style, it’s tending toward the ‘deification’ that Washington was never comfortable with.

Originally posted at Slices of Life blog.

The light blogging lately

April 28, 2010 by · Leave a Comment
Filed under: Photography 

It’s been kinda content light here the past couple of weeks, but things have been a bit busy.

For one of those reasons, I’d like to give a shout out to the really top notch team as the Foster Hospital for Small Animals, which is part of the Tufts Cummings School of Veterinary Medicine.

They did some really amazing work with one of my Golden Retrievers.

Speaking of small animals, the cat is actually in the bag…

Film Camera spotted in the Wild

April 22, 2010 by · Leave a Comment
Filed under: Gear, Photography 

An actual Film Camera spotted in the wild! The person with the camera was taking a photography class, and some of her assignments required an actual film camera to be used.

Originally posted at Slices of Life

Boston Street Sign

February 23, 2010 by · Leave a Comment
Filed under: Our Dear Leader, Politics 

Interesting street sign in downtown Boston.  It has a “Why So Socialist?” Obama sticker, right there in the heart of liberal land.

Stone Lion in the Snow

January 11, 2010 by · Leave a Comment
Filed under: Photography 

One of the stone lions outside the Sigma Alpha Epsilon headquarters in Evanston, IL.

Originally published at Slices of Life Photography Blog.

Worcester Tea Party Pictures

There was a small Tea Party Protest at Lincoln Square in Worcester, MA on September 3, 2009.

This was a warm up for three bus loads of Patriots from the Commonwealth going to Washington, D.C. this week for the 9/12 protests.

I have pictures posted at Urbin Photography & at my account on flickr.

I’m also trying to get them posted at PJTV.

Here is one of the videos I took at this protest.

There was a larger Tea Party Protest in Worcester, MA back on Tax Day.

Next Page »

  • My Tweets

  • Feed Me!