Reputation: 273
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
Reputation: 61477
newX = (500/1130)*1280;
newY = (430/2074)*1024;
In general:
newX = (currentX/currentWidth)*newWidth
newY = (currentY/currentHeight)*newHeight
Upvotes: 11
Reputation: 8269
Ratio!
new width = (500/1130) * 1280
new height = (430/2074) * 1024
Upvotes: 4