Skip to content

Instantly share code, notes, and snippets.

@Aniruddha-Deb
Created March 19, 2021 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aniruddha-Deb/92585262f20b3f3018acdac7d9593408 to your computer and use it in GitHub Desktop.
Save Aniruddha-Deb/92585262f20b3f3018acdac7d9593408 to your computer and use it in GitHub Desktop.
Scrape Math Tutorial Solutions using Screenshots
#!/bin/zsh
set -e
cp $HOME/Desktop/*.png .
# delete all screen 1 screenshots
find . -name '*PM.png' -delete
# convert images one by one
i=1
for img in *.png; do
convert "$img" -crop $1 "out/$i.png"
echo "Converted" "$img"
let i+=1
done
convert out/*.png final.pdf
rm *.png
rm out/*.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment