Created
June 25, 2011 04:48
-
-
Save laclefyoshi/1046149 to your computer and use it in GitHub Desktop.
taking screenshot with Jython
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/jython | |
# -*- coding: utf-8 -*- | |
# Copyright : (c) SAEKI Yoshiyasu | |
# License : MIT-style license | |
# <http://www.opensource.org/licenses/mit-license.php> | |
# last updated: 2011/06/25 | |
from java.awt import Toolkit | |
from java.awt import Robot | |
from java.awt import Rectangle | |
from javax.imageio import ImageIO | |
from java.io import File | |
tk = Toolkit.getDefaultToolkit() | |
ss = tk.getScreenSize() | |
rbt = Robot() | |
bimage = rbt.createScreenCapture(Rectangle(ss)) | |
ImageIO.write(bimage, "png", File("screenshot.png")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment