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 › how do I make an image and save it
Page Index Toggle Pages: 1
how do I make an image and save it? (Read 521 times)
how do I make an image and save it?
Nov 12th, 2007, 12:18pm
 
how do I make an image copying the canvas, without using "loadImage()" ?

(eg scenario:
Drawing a rectangle, copy the canvas into a PImage, and then display the PImage instead to save processor time.

I have lots of these vector shapes and it'd be much faster if I can imprint them as images and displaying them as bitmaps.)
Re: how do I make an image and save it?
Reply #1 - Nov 12th, 2007, 1:19pm
 
try the PGraphics function.

http://processing.org/reference/PGraphics.html
Re: how do I make an image and save it?
Reply #2 - Nov 12th, 2007, 10:11pm
 
just make a PImage file that is the same size as the canvas


PImage var = new PImage(width,height);

then you can copy the entire canvas to the PImage

loadPixels();
arraycopy(pixels,var);
updatePixels();
Re: how do I make an image and save it?
Reply #3 - Nov 12th, 2007, 11:53pm
 
Thanks!!
Page Index Toggle Pages: 1