0

I need to resize image,according to the specific aspect ratio.

For example if I have image with this dimensions 1600*800 the ratio is 2:1,

let's say I need to resize the image so the ratio have to be like that 2:3.

Any idea how can I implement it?

Michael
  • 13,950
  • 57
  • 145
  • 288
  • try to read this [thread](http://stackoverflow.com/questions/1940581/c-sharp-image-resizing-to-different-size-while-preserving-aspect-ratio) – StackOverflowUser May 07 '13 at 07:31
  • assuming you don't want to stretch the image: you can't just resize as the aspect ratio is different. so you either have to crop or add something or a combination of both. make a diagram on a piece of paper, label the dimensions, work out the geometry and you will have your answer!! – morishuz Jul 15 '13 at 14:34

1 Answers1

2

just set the width based on the height value * a scalar

width = height * 2 //2:1
width = height * 0.66 //2:3
Sayse
  • 42,633
  • 14
  • 77
  • 146