Created
September 1, 2016 20:33
-
-
Save Azlirn/06c614e6d1d82f6fe0976c318ba06420 to your computer and use it in GitHub Desktop.
A snippet that allows users to take a screenshot of a website after it opens in Firefox
This file contains hidden or 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
from PIL import ImageGrab | |
import webbrowser | |
import time | |
browser = 'firefox' | |
url = 'https://twitter.com/cyb3rdude' | |
webbrowser.get(browser).open_new_tab(url) | |
# Wait a few seconds to allow the page to load | |
time.sleep(2) | |
# Bounding box optimized to only grab the tweet url and tweet in the screenshot. | |
image = ImageGrab.grab(bbox=(50, 130, 2200, 1200)) | |
# Save the new image | |
image.save("image.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only supported on OSX