FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Image scaling and alignment.
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Image scaling and alignment.  (Read 295 times)
Phiil

WWW
Image scaling and alignment.
« on: Jun 5th, 2004, 12:22pm »

Hi,
 
I've been messing around with Processing for a few days now, trying to get my head around the syntax and so on. I'm not trying to create art yet, just messing about  
 
Anyway - here is my second exercise - overlaying two images (the 2nd one being displayed while the mouse is pressed).  
 
http://homepage.ntlworld.com/philifledermaus/processing/blink%20comparat or/
 
There will be more to it than this, but at the moment I just want to sort this out first so I don't spend hours fine tuning pixel positions only to find there's a really easy way of doing things!
 
Anyway - I need to scale the mdi image by about 0.75 and centre it, and thought that since the images were 256x256 this would just require the use of:
 
scale(0.75);
imageMode(CENTER_DIAMETER);
image(mdi, 128, 128 );
 
However, when I did that, it definitely wasn't in the centre of the image. Lots of playing around with scale and imageMode just resulted in much confusion. It seems that when calling  
 
image(mdi, x, y)
 
the x and y coordinates are scaled too?  
 
Is there a different way of doing this, where the coordinates can be addressed as normal, so that I can just use 128,128 for the centre as expected, rather than this business of having to recalculate new coordinates for different values of scale()?  
 
It just seems... ungainly. Am I overlooking something obvious, or is this just one of those things where it would invariably be easier to sort out by Photoshopping the original image beforehand?
 
Thanks,  
 
Phiil
 
JohnG

WWW
Re: Image scaling and alignment.
« Reply #1 on: Jun 5th, 2004, 12:47pm »

you should be able to do:
image(mdi,128,128,<desired width/2>,<desired hight/2>); so no need for scale and suchlike.
 
Phiil

WWW
Re: Image scaling and alignment.
« Reply #2 on: Jun 5th, 2004, 12:56pm »

on Jun 5th, 2004, 12:47pm, JohnG wrote:
you should be able to do:
image(mdi,128,128,<desired width/2>,<desired hight/2>); so no need for scale and suchlike.

 
 
Thank you John! That does the job nicely
 
Pages: 1 

« Previous topic | Next topic »