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 › Re: Saving screen to image. how
Page Index Toggle Pages: 1
Re: Saving screen to image. how? (Read 373 times)
Re: Saving screen to image. how?
Apr 28th, 2007, 4:00pm
 
sorry, i accidentally deleted a post from leRiCl regarding saving the screen to an image. (i only meant to delete my reply so i could rewrite it properly).

the question was:

----

I have drawn a 3D sphere onto the canvas. Now I try to copy the screen into the image and save the image as a file using this code.
Code:

PImage img = createImage(screen.width, screen.height, RGB);
img=get(); // tried get but didn't work
loadPixels(); //trying to copy screen pixels
img.loadPixels();
arraycopy(pixels, img.pixels);
updatePixels();
img.updatePixels();
img.save(savePath("Planet.png")); //compiler told me to use "savePath" because its an absolute path *shrugs*, it saves the file, so its fine, I guess.

but all I get is an image with a black screen the size of my screen.

Thanks for the help.

----

the answer: you can use saveFrame() to write the image as a file, or if you need the PImage, the following should be all that's needed:

PImage img = get();
// do something here with img
img.save("Planet.png");

if that's not working, we'd have to see the rest of your code.
Re: Saving screen to image. how?
Reply #1 - Apr 30th, 2007, 10:04am
 
You'd need a copy of my incomplete GUI lib to run this, if you need it I will post it somewhere.

http://rafb.net/p/6vty1D50.html

lasts 24 hours.... but its too long to post here. :/

here is the source to the lib....:
http://rafb.net/p/CNn4pH82.html
if you want the binary version I will upload it.
Page Index Toggle Pages: 1