#!/bin/sh # thumbnef - Copyright 2004 Brian Ristuccia # # Create freedesktop.org style thumbnails from .nef files in current # working directory. (Causes gimp preview and konqueror icons to work). # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. umask 077 TEXTFILE=`tempfile` for f in *.nef do URI=file://`pwd`/"$f" HASH=$(echo -n $URI| md5sum|cut -d ' ' -f 1) FILENAME=$HOME/.thumbnails/normal/$HASH.png if [ $FILENAME -ot $f ] then echo "Thumbnailing $f" MTIME=`date -r "$f" +%s` TEMPNAME=$FILENAME.$HOSTNAME.$$ echo "Thumb::URI $URI" > $TEXTFILE echo "Thumb::MTime $MTIME" >> $TEXTFILE echo "Software thumbnefs" >> $TEXTFILE if dcraw -h -w -2 -c "$f" | convert - -resize 128x128 -depth 8 pnm:- | pnmtopng -text $TEXTFILE > $TEMPNAME then mv -v $TEMPNAME $FILENAME fi rm $TEXTFILE else echo "Skipping $f" fi done