Created
July 30, 2019 16:44
-
-
Save arwankhoiruddin/b3b903bdddda1ccad887dda62a9db7b8 to your computer and use it in GitHub Desktop.
Screen capture image using Sikuli and Robot
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
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import org.sikuli.script.Screen; | |
import org.sikuli.script.ScreenImage; | |
import javax.imageio.ImageIO; | |
public class CaptureSikuli { | |
public static void main(String[] args) throws Exception { | |
capture("/Users/arwankhoiruddin/Documents/coba.png"); | |
} | |
public static void capture(String imgPath) throws Exception { | |
Screen s = new Screen(0); | |
ScreenImage img = s.capture(); | |
BufferedImage image = img.getImage(); | |
ImageIO.write(image, "png", new File(imgPath)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment