# Calculate x/y coordinates of an overlayed image when the underlying image is resized. [closed]

I can't post images until I have 10 reputation points. I'll try to explain without them.

I have an image that is 35x29 pixels in size and overlayed on an image that is 168x46 pixels in size. The overlayed image is located at x/y pixel coordinates 73x12 from the top left corner of the 168x46 size image.

If the underlying image size was changed to 743x203, how do I calculate what the x/y pixel coordinates for the overlayed image should be changed to so that it appears in the same position? The overlayed image would also increase in size keeping its aspect ratio.

## closed as unclear what you're asking by Shailesh, Adrian Keister, Xander Henderson, Parcly Taxel, TaroccoesbroccoJul 21 '18 at 11:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

The critical parameter is the amount of the scaling. I note that $743/168 \approx 4.422$, and $203/46 \approx 4.413$, so evidently the scaling enlarged the image by a factor of about $4.42$.
So apply that same factor to the coordinates $(73, 12)$, and you should get something close to what you want: $(323, 53)$. There may be some jiggering you need to do, depending on whether the top left pixel is $(0, 0)$ or $(1, 1)$, and whether you want to align with the corner of the enlarged pixel, or with the center of the enlarged pixel. But this jiggering should be no more than the scaling factor in pixels (i.e., $4$ to $5$ pixels).