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.
Page Index Toggle Pages: 1
crop image? (Read 1507 times)
crop image?
Apr 20th, 2008, 7:33pm
 
i couldnt find this (seemingly easy) thing:

how can i crop an image, for example only show the right half of the image?
Re: crop image?
Reply #1 - Apr 21st, 2008, 1:07pm
 
Just select the crop tool from the toolbox and select(drag)particular portion of the image with it, then hit on the enter key.
Regards
image editing services- Sai BPO Services(UK) Ltd
www.saibposervices.co.uk/Image-editing.aspx
Re: crop image?
Reply #2 - Apr 21st, 2008, 3:16pm
 
sorry, what?

i thought maybe it is possible to crop a loaded image inside processing...
Re: crop image?
Reply #3 - Apr 21st, 2008, 3:36pm
 
by using the copy function (http://processing.org/reference/copy_.html) you can crop it, just specify the x, y, width and height that you want from the original image. An example where the right half of the image is shown on the left of the screen:

Code:
PImage oImg;
void setup() {
size(1024,1024);
oImg = loadImage("815.jpg");
}

void draw() {
background(0);
int iStart = new Float(oImg.width/2).intValue();
int iWidth = oImg.width-iStart;
copy(oImg, iStart,0,iWidth,oImg.height,0,0,iWidth,oImg.height);
}
Page Index Toggle Pages: 1