dotfiles/home/bin/executable_screenshot-monitor
2023-03-04 17:45:19 +08:00

27 lines
1006 B
Bash

#!/bin/sh -e
# Get the picture from maim
# flameshot gui -r > $HOME/.cache/src.png &
grim -g "$(slurp -or)" $HOME/ramdisk/src.png &
wait $!
# add shadow, round corner, border and watermark
convert $HOME/ramdisk/src.png \
\( +clone -alpha extract \
-draw 'fill black polygon 0,0 0,8 8,0 fill white circle 8,8 8,0' \
\( +clone -flip \) -compose Multiply -composite \
\( +clone -flop \) -compose Multiply -composite \
\) -alpha off -compose CopyOpacity -composite $HOME/ramdisk/output.png
convert $HOME/ramdisk/output.png -bordercolor none -border 20 \( +clone -background black -shadow 80x8+15+15 \) \
+swap -background transparent -layers merge +repage $HOME/ramdisk/des.png
# composite -gravity South ~/.local/bin/watermark.png $HOME/ramdisk/des.png $HOME/ramdisk/des.png
# Send the Picture to clipboard
# xclip -selection clipboard -t image/png -i $HOME/ramdisk/des.png
wl-copy -t image/png < $HOME/ramdisk/des.png
# remove the other pictures
rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png