add three scripts
add imgcat imgchange and showxyz
This commit is contained in:
28
imgchange.sh
Executable file
28
imgchange.sh
Executable 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
|
||||
Reference in New Issue
Block a user