java - Screenshot capture in Window 8 OS -


In order to capture the screen shot in my Java application, I wrote the following code

  Rectangle ScreenTrack = new rectangle (Toolkit.getDefaultToolkit (.) GetScreenSize ()); BufferedImage Capture = New Robot (). CreateScreenCapture (screenRect); ImageIO.write (capture, "PNG", new file ("Resource / IMG / Screenshots"));   

It is working successfully and captures the screen shot but this window does not work in the operating system. Any other person has to face this type of problem and get it?

You can do this without using the following code in your local machine by typing the file

  byteoinputprost boss = new byteOnputstream (); Byte [] imageByte = null; Try {// Screen to get screen size • Screen rectangle = new rectangle (toolkit .getDefaultToolkit (.) GetScreenSize ()); To store Scanner shot in buffer. BufferedImage Capture = New Robot (.createScreenCapture (screenRect); // Save image to specific location ImageIO.write (capture, "PNG", boss); Bos.flush (); ImageByte = bos.toByteArray (); Bos.close (); // file file = new file ("resource / img / screenshot"); MultipartEntity mpEntity = new MultipartEntity (); // content body cfBody = new file body (file); Material body cfBody = new bytererabi (image, "screenshot.png"); MpEntity.addPart ("screenshot", cfBody);   

}

Send the byte array directly to the image

Comments

Popular posts from this blog

c++ - Cmake produces file extensions in static library archives -

c# - Roxy file manager in MVC doesn't accept session path -

c# - Check if a NumericUpDown has no value -