Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #4210

Re: Compare two images....?

Newsgroups comp.lang.java.help
Date 2018-01-15 00:45 -0800
References <fab9b7de-cf42-47be-961a-bc2cc99d3378@e6g2000prf.googlegroups.com>
Message-ID <9a305105-5f0d-4fb4-bd78-2cde20c95f96@googlegroups.com> (permalink)
Subject Re: Compare two images....?
From peter.kariuki@nbo.samadc.org

Show all headers | View raw


On Tuesday, April 1, 2008 at 10:11:23 PM UTC+3, TheBigPJ wrote:
> 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)

https://photos.google.com/u/1/photo/AF1QipO13vU8-ye2z6EpePeG291YDp7MMupEVxl6rs9V

https://photos.google.com/u/1/photo/AF1QipPplix9mZCFzWdOl7GJiZWjrid2qcKxlagwluzY

Back to comp.lang.java.help | Previous | Next | Find similar


Thread

Re: Compare two images....? peter.kariuki@nbo.samadc.org - 2018-01-15 00:45 -0800

csiph-web