13,147,591 members (29,037 online)
Rate this:
See more:
hi all
i have an image of the desktop,the image size is smaller than the desktop size
how can i find a point on the desktop corresponding to the a point in the image
Posted 24-Oct-11 7:51am
SAKryukov 24-Oct-11 14:01pm

How corresponding? 1) coordinate transform from bitmap to screen coordinates, 2) image is a reduced image of the desktop and you need to find a point on desktop mapped to a point on the image?
--SA
SAKryukov 24-Oct-11 14:10pm

What, no platform, language, UI library specified? Does not matter much though...
--SA

Rate this:

## Solution 1

Please see my comment to the question. In both cases, this is not a problem for gradate students. It means the solution of linear equations which is a work for middle school or early high school student (it depends on your school system, but it requires level well below the required entry level of a college, university or a technical school student). It's reduced to the ability to solve equations like

```<br />
X<sub>1</sub> = X<sub>0</sub> + K × X<sub>2</sub><br />
Y<sub>1</sub> = Y<sub>0</sub> + K × Y<sub>2</sub><br />```

Wake up and solve them.

—SA
Rate this:

## Solution 2

Assuming you have a point on the image relative to the top left hand corner of the image in terms of image coordinates, then it is a simple matter of scaling:

Xdesktop = Ximage * (Widthdesktop / Widthimage)

Ydesktop = Yimage * (Heightdesktop / Heightimage)

Obviously, you won't necessarily get to exactly that point - there will be an error of a pixel or two depending on the relative sizes.
Rate this:

## Solution 3

Let the coordinates of point on image be x,y. Then your corresponding point on desktop will be like this.

new point = new point(x* Desktopwidth/imagewidth,y*Desktopheight/imageheight)

This is in theory, but i hope you get my point. If you don't then reply.

Top Experts
Last 24hrsThis month
 OriginalGriff 285 Kornfeld Eliyahu Peter 100 CPallini 50 Graeme_Grant 40 Dave Kreskowiak 40
 OriginalGriff 6,240 Graeme_Grant 5,091 ppolymorphe 1,994 Jochen Arndt 1,904 CPallini 1,855