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
Image panning (Read 742 times)
Image panning
Oct 31st, 2009, 5:21pm
 
Hi,

I am a max/msp person and am trying to find a tool for image viewing but with no luck. Basically, I want be able to just load an image and set a viewing window size then set a location in the image to view.

For example. I want a viewing window of 400x500, then I want to load an image that is 1440x900. I think want be able to just use the basic translate(), rotate(); scale(), and then be able to just pan around and arrange the image.

I don't want to have it take up the whole window though cause I want to be able to instantiate it and have a few side by side.

Any help on how to do this would be very much appreciated.

thanks

jon
Re: Image panning
Reply #1 - Nov 1st, 2009, 12:46am
 
You are probably looking for copy() from an off-screen image to a selected area of the sketch surface.
Re: Image panning
Reply #2 - Nov 1st, 2009, 3:49pm
 
awesome, thank you very much. Seems like it was an obvious one I should have found, thanks for saving me the time of trying to stumble on to it

Re: Image panning
Reply #3 - Nov 1st, 2009, 4:27pm
 
one more question, is there a way for me to copy() without the image I am coying from being visible? when I don't load the img, I just declare it, nothing comes up in the copy area
Re: Image panning
Reply #4 - Nov 1st, 2009, 9:14pm
 
Quote:
...and copies a region of pixels from an image used as the srcImg parameter into the display window.



copy(srcImg, x, y, width, height, dx, dy, dwidth, dheight)
Re: Image panning
Reply #5 - Nov 1st, 2009, 11:16pm
 
JRose wrote on Nov 1st, 2009, 4:27pm:
when I don't load the img, I just declare it, nothing comes up in the copy area

Yes, that's logical... You can avoid to display it, but if you don't load it, it won't magically be available in the sketch.
When you do a loadImage(), it isn't displayed at all, it is off-screen as I wrote. You have to do an img() call, or, in your case, a copy(), to bring it on screen.
Page Index Toggle Pages: 1