stretch whole Image to have inner section be a specific dimension

I have an image. Below is a small representation of the real image’s layout. The dimenstions of my image are 600px × 449px, and The dimensions for the inner secion of my image are 541px × 341px.

The layout of my image

I want the dimensions for the inner section of my image to be 320px × 240px. I want to know how much I would have to shrink the whole image, both width and height (aspect ratio is not important) in order to make the inner section have the dimensions of 320px × 240px.

I would be grateful if you could tell me how to calculate this and/or calculate it yourself as well as tell me how much to shrink the width, and how much to shrink the height.

Answer

320 / 541 = .591 (that is, 320 pixels is 59.1% of 541 pixels)

600 * .591 = 354.6 (so 354.6 is 59.1% of 600)

rounded up to 355 pixels

There’s your width; do the same calculations for the height.

//edit for height:

240 / 341 = .704
449 * .704 = 316.1

round down to 316px

Attribution
Source : Link , Question Author : Web_Designer , Answer Author : joshmax

Leave a Comment