Search code examples
macrospixelresolution

Formula for converting XY pixel coordinate in 1920x1080 to 1366x768


Here im trying to edit a macro setup for 1920x1080 to 1366x768(im using rn) If in 1920x1080, x=1621 and y=71 How to convert xy value to my resolution 1366x768?


Solution

  • To convert coordinates from one resolution to another, you can use a simple scaling factor. The scaling factor is the ratio of the new resolution to the old resolution. In your case, you want to convert from 1920x1080 to 1366x768.

    Here's how you can calculate the scaling factors for both X and Y coordinates:

    Scaling Factor X = New Resolution Width × Old Resolution Width

    Scaling Factor Y = New Resolution Height × Old Resolution Height ​

    For your case:

    Scaling Factor X = 1366 × 1920 ≈ 0.711

    Scaling Factor Y = 768 × 1080 ≈ 0.711

    Now, you can use these scaling factors to convert your coordinates. Given your original coordinates (x=1621, y=71):

    New X = Scaling Factor X × Old X

    New Y = Scaling Factor Y × Old Y

    Plug in the values:

    New X = 0.711×1621 ≈ 1151

    New Y = 0.711 × 71 ≈ 50

    So, the converted coordinates for a 1366x768 resolution would be approximately x=1151 and y=50. These are the coordinates you can use for your macro setup in the 1366x768 resolution.9mo