13.04+: Move camera images to desktop
#!/bin/bash
# photo move and compress script, by robert klebe
# to move files from memory card to desktop and make resized
# compressed versions usable for Tradera and other sites
# note: requires imagemagick, run
# apt-get install imagemagick
# to install it
# also check your sd card directory so it matches SOURCEDIR below
# changelog
# 2013-09-23 - first version
# get the desktop path
DESKTOPDIR=$(/usr/bin/xdg-user-dir DESKTOP);
# get files from this dir
SOURCEDIR="/media/$USER/CANON G9/";
# path to the target dir
TARGETDIR="$DESKTOPDIR/Kamerabilder/";
# make sure the target dir exists
mkdir -p "$TARGETDIR";
# move all files from the target
find "$SOURCEDIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec mv '{}' "$TARGETDIR" \;
# walk the files in target dir
while read file
do
# extract basename, /bla/bla/file.jpg -> file.jpg
SN="${file##*/}"
# extract basename without ending, file.jpg -> file
SN=${SN%.*}
# run convert on it the fastest way
convert "$file" -quality 30 -auto-orient -strip -sample 1024x768 "${TARGETDIR}${SN}_1024x768.jpg"
done < <( find "$TARGETDIR" -type f -iname '*.jpg' )
This is a personal note. Last updated: 2013-10-01 02:02:24.



