1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
#!/bin/sh
if [ $# = 0 ] || [ $1 = "-h" ] || [ $1 = "--help" ];
then
echo "Usage: xvpicmaker FILE1 [FILE2 ...]"
echo " or: xvpicmaker DIRECTORY"
echo "Create the .xvpics directory and icons"
echo
echo "The .xvpics directory'll be removed and recreated if you give a"
echo "directory name."
echo "Version 1 (gif,jpg,pcx,bmp,tif,tga)"
echo
fi
if [ $# = 1 ] && test -d $1 ;
then
rm -rf $1/.xvpics
for name in $1/*; do
if test ! -d $name
then
xvpicmaker $name
fi
done
else
for name do
if test -d $name
then
echo "directory:'$name'"
else
case $name in
**.gif) echo "create icon :'$name'"
if test ! -d ${name%/*}/.xvpics
then
mkdir ${name%/*}/.xvpics
fi
cat $name |
giftopnm |
pnmscale -xysize 80 60|
ppmtoxvpic > ${name%/*}/.xvpics/${name##*/} ;;
**.jpg) echo "create icon :'$name'"
if test ! -d ${name%/*}/.xvpics
then
mkdir ${name%/*}/.xvpics
fi
cat $name |
djpeg |
pnmscale -xysize 80 60|
ppmtoxvpic > ${name%/*}/.xvpics/${name##*/} ;;
**.pcx) echo "create icon :'$name'"
if test ! -d ${name%/*}/.xvpics
then
mkdir ${name%/*}/.xvpics
fi
cat $name |
pcxtoppm |
pnmscale -xysize 80 60|
ppmtoxvpic > ${name%/*}/.xvpics/${name##*/} ;;
**.bmp) echo "create icon :'$name'"
if test ! -d ${name%/*}/.xvpics
then
mkdir ${name%/*}/.xvpics
fi
cat $name |
bmptoppm |
pnmscale -xysize 80 60|
ppmtoxvpic > ${name%/*}/.xvpics/${name##*/} ;;
**.tif) echo "create icon :'$name'"
if test ! -d ${name%/*}/.xvpics
then
mkdir ${name%/*}/.xvpics
fi
cat $name |
tifftopnm |
pnmscale -xysize 80 60|
ppmtoxvpic > ${name%/*}/.xvpics/${name##*/} ;;
**.tga) echo "create icon :'$name'"
if test ! -d ${name%/*}/.xvpics
then
mkdir ${name%/*}/.xvpics
fi
cat $name |
tgatoppm |
pnmscale -xysize 80 60|
ppmtoxvpic > ${name%/*}/.xvpics/${name##*/} ;;
esac
fi
done
fi
echo "done."
|