Mailinglist Archive: opensuse (1420 mails)

< Previous Next >
Re: [opensuse] gphoto2 - download image file rename/classify helper script
* David C. Rankin <drankinatty@xxxxxxxxxxxxxxxxxx> [01-04-14 04:28]:
Using gphoto2 to download, delete or upload images to apple devices is
really handy, but the default filenames contained on the device are
horrible. (non-descript, upper-case, etc..). For example, after
downloading all images from your device you have a directory full of:

02:44 alchemy:~/mmedia/iPhone/iph3-black-sav> l1
IMG_0001.JPG
IMG_0002.JPG
IMG_0016.MOV
IMG_0032.PNG
IMG_0033.JPG
IMG_0034.PNG
IMG_0182.MOV
IMG_0183.JPG
IMG_0186.MOV
IMG_0188.MOV
IMG_0189.JPG
IMG_0190.JPG
...

This contains all images in the "camera roll" including photos, saved
graphic files and videos. For permanent storage, I want the photos
separated from the graphic and video files in a way that is easy to
manage. If anyone has a similar issue, I've cobbled together a helper
script to parse the file, examine the EXIF and PNG headers and rename
them into separate directories with filenames that contain the image (or
filemod) date along with the original image number for reference.
Example:


bkgnd
img_20120102-195924_0024.jpg
img_20120102-203607_0034.png
images
img_20120102-203551_0032.png
img_20120102-203559_0033.jpg
photos
iPhone_3GS_20130509-154717_0470.jpg
iPhone_3GS_20130707-142745_0517.jpg
videos
img_20111226-133705_0016.mov
img_20120303-173828_0177.mov

[...]

I do something similar but much different. I am team photog for a
regional travel soccer team and the local high school soccer team
(grandson is goalie and high school was state runner up this year).

I use Nikon gear and usually two cameras at each event. I time sinc the
cameras before an event. After an event, I dl the photos from the flash
cards via card reader to computer, lowercase the filenames, adjust file
dates to the exif "Create Date", then rename the files by adding the
Date-Time to the filename.

Now my photos are time sequenced and identifiable.

redate changes file date to exif "Create Date"
lc;exiv2 -T ./*.{nef,jpg}

rename2date
exiv2 mv \-k \-r %y%m%d_%H%M%S_:basename: \.\/*.{nef,jpg}'

lc = /usr/bin/lowercase_filenames ## from shtools
## obs://build.opensuse.org/home:hennevogel

exiv2 rather than exiftool as exiv2 is compiled and *much* faster

I also add location data as I am too cheap to buy the gps equipment which
also depleates my batteries, using a free app on my android phone,
GPSLogger. The app automagically emails me the gps coordinates and
altitude which I add by script to the photos:
gpsPhoto --dir ./ --geotag-source=option
--geotag=39.685443,-86.274003,211.000000
(that's one liner)

gpsPhoto (obs://build.opensuse.org/Application:Geo):
A commandline tool to synchronize a gps (gpx) tracklog with the date/time
stamps of the image exif-data

gpsPhoto geotags digital photos by using GPS track data recorded at the
same time. Matches are based on closest timestamps. An optionally
generated Google Earth KML or KMZ file contains the GPS tracks and the
geotagged photos.

The purpose of this tool is to allow a hiker to record a GPS tracklog or
waypoints and later (at home) synchronize this GPS data with the
timestamps of the image exif data of his digital camera, in order to
locate and store the position where the picture was taken. The tool
writes coordinates, altitude and additional metadata to the Exif and IPTC
metadata section of jpeg, nef and potentially other file formats.
Optionally, a Google Earth kml file is created containing the gps tracklog
and the image positions.

## Of little interest to most people
## But perhaps insight or suggestive in your application.

ps: Weather was great, traffic much less so, on our pass across the South
over holidays. Floated the San Antonio canals, visited Alamo and another
mission and ate very good food. Galveston, New Orleans during the storm,
but Orlando was upper 70s to lower 80s and partly sunny. Soccer events
just so-so, 1-1-1, but venue marvelous.

--
(paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri
http://en.opensuse.org openSUSE Community Member facebook/ptilopteri
http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2
Registered Linux User #207535 @ http://linuxcounter.net
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
References