iOS_Learner
iOS_Learner

Reputation: 169

Transforming Line Points According to resized UIImage

I have UIImage with size 7017x4962 and have line points A(532,1118) and B(4114,1118).I have reduced the UIImage size to 2339x1654.How can I transform the line points according to new UIImage size.

Upvotes: 0

Views: 29

Answers (1)

davidf2281
davidf2281

Reputation: 1328

Multiply x and y proportionate to the new image width and height for each coordinate pair:

x * (2339.0f / 7017.0f)

y * (1654.0f / 4962.0f)

This will give you A(177, 372) and B(1371, 372).

Upvotes: 1

Related Questions