Skip to content Skip to sidebar Skip to footer

Convert X And Y Px Base On Screen Size

im using this command input tap x y (input tap 600 500) in a phone with a screen resolution of 720 x 1280 how do I convert the x y so it will be same point in a phone with a resolu

Solution 1:

This pseudo code should get you the values you're looking for:

resolution_width = 720;
resolution_height = 1280;

input_x = 600;
input_y = 500;

target_width = 1080;
target_height = 1920;

percent_width = input_x / resolution_width;
percent_height = input_y / resolution_height;

output_x = target_width * percent_width;
output_y = target_height * percent_height;

Post a Comment for "Convert X And Y Px Base On Screen Size"