We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › screenshot second monitor too
Page Index Toggle Pages: 1
screenshot second monitor too (Read 355 times)
screenshot second monitor too
Feb 5th, 2009, 1:49pm
 
I made a little app to take a screenshot and a camera grab at the same time, every 10 seconds, so I can make a sort of timelapse thingie.  It all works fine except i can't screenshot the second monitor, it appears black.
Any help?

Code:

import processing.video.*;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;

int period = 10000; // milliseconds between frames

//----------------------------------------------------------
BufferedImage screencap;
Capture myCapture;
long lastCaptureTime = 0;
int saveCount = 0;

//----------------------------------------------------------
void setup(){
size(720,320);
smooth();
myCapture = new Capture(this, 320,240);
textFont(createFont("Arial",12));
background(0);
}

//----------------------------------------------------------
void draw() {

long now = millis();
if ((now - lastCaptureTime) >= period){
background(0);
scrCapt();
camCapt();

text(hour() +":"+ minute(), 4,height-12);

String filename = "poze/timelapse_" + nf(saveCount, 6) + ".jpg";
saveFrame(filename);
lastCaptureTime = now;
saveCount++;
}

}



void camCapt(){
if(myCapture.available()) {
myCapture.read();
image(myCapture, 0,0);
}
}



void scrCapt(){
try{ screencap = new Robot().createScreenCapture( new Rectangle(0,0,screen.width,screen.height) ); }
catch (AWTException IOException){
println("1");
}

PImage img = new PImage(screencap);
int div = 4;
image(img,320,0, img.width/div, img.height/div);
}


Also, if you see any other things to improve, feel free.
Re: screenshot second monitor too
Reply #1 - Feb 5th, 2009, 6:12pm
 
oh come on Sad
Re: screenshot second monitor too
Reply #2 - Feb 5th, 2009, 6:42pm
 
Wow, impatient Not only people of this forum are around the world, so some might still sleep. But I doubt many people have several monitors (I don't).

Maybe this Sun bug page might be of interest: the bug might be (or not) related to your issue, but it also has some example code.

HTH.
Page Index Toggle Pages: 1