12,396,230 members (59,048 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

```X1 = X0 + K × X2 Y1 = Y0 + K × Y2 ```

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 130 ppolymorphe 90 Jochen Arndt 85 BillWoodruff 70 0x01AA 50
 OriginalGriff 6,128 ppolymorphe 2,430 Karthik Bangalore 2,382 F-ES Sitecore 1,877 Richard MacCutchan 1,752