add three scripts

add imgcat imgchange and showxyz
This commit is contained in:
2018-03-19 11:34:26 -07:00
parent f49bf4e26f
commit fcfd49e1b5
3 changed files with 216 additions and 0 deletions

28
imgchange.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
data='null'
outdata='null'
while getopts "hi:r" arg
do
case $arg in
h)
printf "some commonly used tricks of imagemagick \n"
printf "usage: ${0##*/} -i<image-file> [-r] \n"
printf "%s\t%s\n" "-i" "input image file"
printf "%s\t%s\n" "-r" "remove white background of the input image and apply a transparent background."
exit 0;;
i)
data=$OPTARG;;
r)
outdata=${data%.*}-nobg.png
convert ${data} -bordercolor white -border 1x1 -matte -fill none -fuzz 20% -draw 'matte 0,0 floodfill' -shave 1x1 ${outdata};;
?)
printf "error: unknow argument\nuse -h option to see help information\n"
exit 1;;
esac
done
if [[ $data == 'null' ]]; then
printf "error: no input file name\nuse -h option to see help information\n"
exit 1
fi