| 12345678910111213141516171819202122232425262728293031323334353637 | #!/bin/bashif [[ $1 == "" || $2 == "" ]]; then     echo "Usage: $0 [input-file] [output-file]"    exit -1;fi if [ ! -f $1 ]; then    echo "$1 input file not exists."    exit -1;fiif [ -f $2 ]; then    echo "$2 output file already exists."    exit -1;fiif [ ! -d ~/.rembg ]; then    echo "Installing rembg in ~/.rembg"    python -m venv ~/.rembg    ~/.rembg/bin/pip install rembg[gpu,cli]fiif [ ! -d /tmp/prepare-image ]; then     mkdir /tmp/prepare-imagefiecho "Processing image $1..."temp=/tmp/prepare-image/$(basename $2).png~/.rembg/bin/rembg i $1 $tempmagick $temp -background white -flatten -trim $2rm $tempecho "Saved as $2."
 |