Calculate x/y coordinates of an overlayed image when the underlying image is resized. [closed]
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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.
algorithms arithmetic arithmetic-geometry
closed as unclear what you're asking by Shailesh, Adrian Keister, Xander Henderson, Parcly Taxel, Taroccoesbrocco Jul 21 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.
add a comment |Â
up vote
1
down vote
favorite
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.
algorithms arithmetic arithmetic-geometry
closed as unclear what you're asking by Shailesh, Adrian Keister, Xander Henderson, Parcly Taxel, Taroccoesbrocco Jul 21 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.
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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.
algorithms arithmetic arithmetic-geometry
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.
algorithms arithmetic arithmetic-geometry
edited Jul 21 at 0:02
asked Jul 20 at 23:38
Zelf
83
83
closed as unclear what you're asking by Shailesh, Adrian Keister, Xander Henderson, Parcly Taxel, Taroccoesbrocco Jul 21 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.
closed as unclear what you're asking by Shailesh, Adrian Keister, Xander Henderson, Parcly Taxel, Taroccoesbrocco Jul 21 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.
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
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).
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
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).
add a comment |Â
up vote
0
down vote
accepted
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).
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
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).
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).
answered Jul 21 at 0:12


Brian Tung
25.2k32453
25.2k32453
add a comment |Â
add a comment |Â