richi arora
richi arora

Reputation: 273

Get pixel position of particular point upon resizing the image i.e changing the resolution of image

Hi I have image of 1130*2074 resolution I marked a point at pixel 500,430 I have resized it to 1280*1024 how to get changed pixel position i.e what will be the new position of pixel 500,430 I know that basically pixel size was affected but still..

Upvotes: 11

Views: 4355

Answers (2)

Femaref
Femaref

Reputation: 61477

newX = (500/1130)*1280;
newY = (430/2074)*1024;

In general:

newX = (currentX/currentWidth)*newWidth
newY = (currentY/currentHeight)*newHeight

Upvotes: 11

BeemerGuy
BeemerGuy

Reputation: 8269

Ratio!

new width = (500/1130) * 1280
new height = (430/2074) * 1024

Upvotes: 4

Related Questions