Last active
March 14, 2020 13:27
-
-
Save hyuki/4c38162000fd28f0571fc969d3800e5f to your computer and use it in GitHub Desktop.
gcap.rb - Screen capture
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 ruby | |
# $ grep GCAP_SAVE_DIR ~/.bash_profile | |
# export GCAP_SAVE_DIR=/Users/YOUR/SAVE/DIR | |
dir = ENV['GCAP_SAVE_DIR'] | |
n = 0 | |
while | |
filename = "#{dir}/#{n}.png" | |
break if not File.exist?(filename) | |
n += 1 | |
end | |
# $ man screencapture | |
system(%Q(screencapture -i #{filename})) | |
# Add transparent 1 pixel to the png image. | |
system("transpoint #{filename}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment