DKL9 GitList
Repositories
DKL9 home
memoire
Code
Commits
Branches
Tags
Search
Tree:
4962ab3
Branches
Tags
master
memoire
occlude.sh
Add highlight function to occlude.sh
dkl9
commited
4962ab3
at 2023-185 07:17:49
occlude.sh
Blame
History
Raw
#!/bin/sh # occlude - generate a set of images with rectangular sections occluded # usage: occlude img # Displays img in iv and generates a numbered occluded image # for every two middle-clicks (which select a position in the image). # You can also use it as `highlight img` (with a symlink) and it will # highlight those rectangular sections instead of occluding them. IFS=', ' BFN="${1%.*}" FE="${1##*.}" CTR=1 MODE=`basename "$0"` MODE="${MODE%%.*}" if [ "$MODE" = occlude ] then MARGS='-fill black' elif [ "$MODE" = highlight ] then MARGS='-stroke black -strokewidth 1.5 -fill #c0ff0040' fi '/usr/local/bin/iv' "$1" | while read X Y do if [ -n "$SX" ] then magick "$1" $MARGS -draw "rectangle ${SX},${SY} ${X},${Y}" "${BFN}_${CTR}.${FE}" SX='' SY='' CTR="$((CTR+1))" else SX="$X" SY="$Y" fi done