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 & HelpPrograms › Cropping a frame
Page Index Toggle Pages: 1
Cropping a frame (Read 393 times)
Cropping a frame
Mar 7th, 2008, 11:00am
 
Hey. It's me again Smiley

I know how to take a screenshot.

Can someone tell me how to crop this image so I can select only part of the screenshot to be saved?

I figured I need to:

1.- Take the screenshot of the current frame.
2.- Load the ss in a PImage variable.
3.- imgFile.loadPixels()
4.- Crop using the imgFile.pixels[] array
5.- Create a new PImage varible, the size of the cropped image
6.- Copy the cropped imgFile.pixels[] into the new PImage
7.- Save the cropped PImage to disk

Is this correct?
Re: Cropping a frame
Reply #1 - Mar 7th, 2008, 4:26pm
 
I think you can just do something like:

Code:
PImage shot=get(x,y,sswidth,ssheight);
shot.save("foo.jpg");
Re: Cropping a frame
Reply #2 - Mar 7th, 2008, 5:03pm
 
I think it works!

Thanks a lot.
Page Index Toggle Pages: 1