![]() |
Home Compute Contact | ![]() |
|||||
WebifyWhen I switched from windows to linux I had to leave behind the DimageViewer, the application for image viewing and manipulation that came with my nifty minolta camera. Though I truly didn't care much for the application it did bring a certain convenience to to the table in the area of thumbnailed batch image resizing and renaming. Sadly I couldn't find a good replacement for it in linux, perhaps I didn't look hard enough. In what I found there were excellent thumbnail image viewers and excellent image editors, but not both in a single application. I've itched my need by tying gqview, convert and jpegtran together in a shell script. I now have a simple way to rotate, resize and rename my photos complete with gui preview: webify. I installed webify in my ~/bin directory and created three symlinks to it. ln -s ~/bin/webify ~/bin/webifyw ln -s ~/bin/webify ~/bin/webifycw ln -s ~/bin/webify ~/bin/webifyccwI then configured three new editors in gqview. webify webifyw %p webify clockwise webifycw %p webify counterclockwise webifyccw %pI call my webify script with two parameters. The first parameter is the base name that I want the series of resized images to share. The second is the number at which I want the naming series to start. The script calls gqview as a gui in which I can choose to resize my images with or without rotation by choosing one of the defined editors. After I close gqview the script takes over with the rotation, resizing and renaming of my photos and packages them into an archive to upload to my gallery. My wife will agree this little shell script is much more convenient for our purposes than the DimageViewer it was meant to replace. webify:
#!/bin/sh
WEBIFY_ROOT=/home/aaron/webify
WEBIFY_LIST=${WEBIFY_ROOT}/webify.lst
QUALITY=92
SIZE=640x640
case $0 in
*webify )
if [ $# -lt 2 ]
then
echo "Usage: webify BASENAME FIRST_SERIAL"
exit 10
fi
NAME=$1
SERIAL=$2
: > ${WEBIFY_LIST}
gqview
for LINE in `sort ${WEBIFY_LIST}`
do
FILE=${LINE%:*}
SERIAL_STRING=${SERIAL}
let "I=4-${#SERIAL}"
while [ $I -gt 0 ]
do
SERIAL_STRING=0${SERIAL_STRING}
let "I-=1"
done
case ${LINE##*:} in
"w" )
echo "${FILE} becomes ${NAME}${SERIAL_STRING} without rotation"
convert -size ${SIZE} ${FILE} -resize ${SIZE} -quality ${QUALITY} \
${WEBIFY_ROOT}/${NAME}${SERIAL_STRING}.jpg
;;
"cw" )
echo "${FILE} becomes ${NAME}${SERIAL_STRING} by clockwise rotation"
jpegtran -rot 90 ${FILE}|convert -size ${SIZE} - -resize ${SIZE} \
-quality ${QUALITY} ${WEBIFY_ROOT}/${NAME}${SERIAL_STRING}.jpg
;;
"ccw" )
echo "${FILE} becomes ${NAME}${SERIAL_STRING} by counterclockwise rotation"
jpegtran -rot 270 ${FILE}|convert -size ${SIZE} - -resize ${SIZE} \
-quality ${QUALITY} ${WEBIFY_ROOT}/${NAME}${SERIAL_STRING}.jpg
;;
esac
let "SERIAL+=1"
done
TEMP_PATH=`pwd`
cd ${WEBIFY_ROOT}
zip -m ${NAME}${SERIAL_STRING} *.jpg
cd ${TEMP_PATH}
;;
*webifyw )
echo "${1}:w">> ${WEBIFY_LIST}
;;
*webifycw )
echo "${1}:cw">> ${WEBIFY_LIST}
;;
*webifyccw )
echo "${1}:ccw">> ${WEBIFY_LIST}
;;
esac
exit 0
|
|||||||
![]() |
![]() |
||||||
| Home Compute Contact | |||||||