0

I find the robot.createScreenCapture(rectangle) method of screen capturing extremely slow.

I aim to create a smooth GIF Animation and to fulfill this I need to capture my screen (at around 1 frame per 10-30ms). Doing so whilst saving the buffered image as JPEG file slows down my applet terribly.

I got fed up and eventually stored all of the buffered images into an ArrayList before saving them (this time) all at once; and it wasn't a surprise - my applet froze for 2 minutes before crashing...

I don't mind if external programs / libraries do the task better, if you suggest the former I'd rather the program to be able to be executed in java on runtime.

Thanks.

Bob Let
  • 123
  • 1
  • 5
  • 13
  • Have you considered using a screen capture program like fraps, which is designed for recording video? – Arcymag Jul 18 '12 at 18:01
  • It depends if fraps can be executed by command at runtime within java (which I don't think is possible). – Bob Let Jul 18 '12 at 18:06
  • I see. There appears to be a few threads about this in C++ land, so if you can't find anything, then you can always use JNI to C++: http://stackoverflow.com/questions/5069104/fastest-method-of-screen-capturing – Arcymag Jul 18 '12 at 22:04

1 Answers1

1

use JNA to access your OS's internal capture methods (like BitBlt for windows).

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
  • Problem is, my applet will be used by people with different operating systems. I don't know if JNA could "detect" a user's OS then access their internal capture methods. – Bob Let Jul 18 '12 at 18:13
  • You can detect OS and use JNA appropriately: System.getProperty("os.name"). If you want to support multiple OS's it won't be easy, but possible. Dunno why the JDK is *so* slow in this regard... – rogerdpack Jul 18 '12 at 18:46