Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // part of this code comes from here: https://forum.processing.org/two/discussion/4612/how-do-i-take-several-screenshots-from-the-same-part-of-the-display-and-work-with-these
- import java.awt.Robot;
- import java.awt.Rectangle;
- import java.awt.AWTException;
- PImage screenshot;
- boolean smoothOn;
- int x, y, step = 10;
- int w = 855, h = 480, w2 = int(w*.9), h2 =int(h*.9);
- boolean save = false;
- void settings() {
- size(w2, h2);
- }
- void setup() {
- }
- void draw() {
- screenshot();
- modifyPixels();
- image(screenshot, 0, 0, width, height);
- if (save) saveFrame("frames/image-####.tif");
- }
- void screenshot() {
- try {
- Robot robot_Screenshot = new Robot();
- screenshot = new PImage(robot_Screenshot.createScreenCapture
- (new Rectangle(displayWidth-w, 170, w, h)));
- }
- catch (AWTException e) {
- }
- }
- void modifyPixels() {
- screenshot.loadPixels();
- for (int i=0; i<screenshot.pixels.length; i++) {
- if ( brightness(screenshot.pixels[i]) > 150) screenshot.pixels[i] &= 0x00FFFFFF;
- }
- screenshot.updatePixels();
- }
- void keyReleased() {
- if (key =='s') save =! save;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement