459,339 Members | 1,680 Online
Need help? Post your question and get tips & solutions from a community of 459,339 IT Pros & Developers. It's quick & easy.

# Math with coordinates

 100+ P: 132 Hi all, I've got a bit of a challenge. I've got a script which displays the mouse coodinates if you click on an image. Now I would like to convert these coordinates to pixelnumber. Let me see if I can make it easier. Suppose we have an image which is 100px high and 100px wide. The coordinates of the upper left corner would be x=0 and y=0 The coordinates of the upper right corner would be x=99 and y=0 The coordinates of the lower left corner would be x=0 and y=99 The coordinates of the upper left corner would be x=99 and y=99 Now I would like to display these coordinates on an other way, by the pixel they represent. So that would mean: The pixelnumber of the upper left corner would be 1 The pixelnumber of the upper right corner would be 100 The pixelnumber of the lower left corner would be 9901 The pixelnumber of the upper left corner would be 10000 So by using the coordinates I'm sure that these pixelnumbers could be calculated. However, I'm not capable of writing this myself. Can anyone help me with this? Here is code that I have so far: [HTML]
Coordinates
x = y =
pixel = [/HTML] Nov 25 '07 #1