How to calculate the same position on different bitmaps?
I have 2 photos, one is size 300x300
and the other is 1200x1200
. I have drawn one text at a position A = (50, 40)
in the image 300x300
.
How can I calculate the same A position in the image 1200x1200
?
UPDATE 2:
IF size is not round (e.g. 523 x 412 ...) - x, y after multiplication will deviate
source to share
The scaling factor for x and y is 1200/300 = 4
.
Then just multiply x and y by 4
(your scaling factor).
int scaleFactor = 1200 / 300;
int newX = oldX * scaleFactor;
int newY = oldY * scaleFactor;
So, given that oldX = 50 and oldY = 40, the expectex values for newX and newY are 200 and 160, respectively.
source to share