Suggestions on the best (preferably easiest way) to compare two images (captured both from the desktop via java robot) ?
The following code is the code I will be using to take the screen shot (currently it saves just to a file):
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
class Screenshot{
static public void main()
{
try
{
//Get the screen size
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
Rectangle rect = new
Rectangle(0,0,screenSize.width,screenSize.height);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(rect);
File file;
//Save the screenshot as a png
file = new File("screen.png");
ImageIO.write(image, "png", file);
//Save the screenshot as a jpg
file = new File("screen.jpg");
ImageIO.write(image, "jpg", file);
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
Thank you,
Peter (thebigpj)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 286 |
Nodes: | 16 (2 / 14) |
Uptime: | 87:24:47 |
Calls: | 6,496 |
Calls today: | 7 |
Files: | 12,100 |
Messages: | 5,277,153 |