javaawtscreenshotawtrobot

Java screenshot with Robot ressource effectivity


Im writing a program in java which should take screenshots of different windows multiple times per second. It uses the createScreenCapture(Rectangle screenRect) from java.awt.Robot. I have thought of 2 different possible ways to do this:

1.: Take a screenshot of the area of each window.
2.: Take a screenshot ofthe whole screen and then divide it in smaller images.

Which one is more ressource effective?


Solution

  • Device IO is the bottleneck here by leagues, so capture it once into memory, and then operate on that.