Created
March 27, 2020 09:03
-
-
Save colemickens/a61d39206e91523e6cd3378dd0b2360b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x | |
set -euo pipefail | |
grim /tmp/output.png | |
imv -f /tmp/output.png & | |
p="$!" | |
g="$(slurp)" | |
kill "${p}" | |
offset="$(echo "${g}" | cut -d' ' -f1)" | |
left="$(echo "${offset}" | cut -d',' -f1)" | |
top="$(echo "${offset}" | cut -d',' -f2)" | |
dimensions="$(echo "${g}" | cut -d' ' -f2)" | |
convert "/tmp/output.png" -crop "${dimensions}+${left}+${top}" "/tmp/output2.png" | |
imv /tmp/output2.png | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment