blob: ac25661ea01af0a92e2a467c3adc36ffcdb04ae8 (
plain) (
blame)
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
|
#!/bin/bash
usage()
{
echo 'Usage: process-img [-f fuzz] file...' >&2
exit 1
}
while getopts 'f:' opt
do
case "$opt" in
f)
fuzz="$optarg"
;;
*)
usage
esac
done
shift $(($OPTIND - 1))
[ "$#" -eq 0 ] && usage
for img in "$@"
do
(
read w h < <(identify -format "%w %h" "$img")
magick "$img" \
-alpha on -fuzz ${fuzz:-3%} -fill none \
-draw "color 0,0 floodfill" \
-draw "color 0,$((h-1)) floodfill" \
-draw "color $((w-1)),0 floodfill" \
-draw "color $((w-1)),$((h-1)) floodfill" \
"${img%.*}.avif"
) &
done
wait
|