title: How to resize frame's from video with aspect ratio
body: <p>I am using Python 2.7, OpenCV. I have written this code. </p>
  
  <pre><code>import cv2
  vidcap = cv2.VideoCapture('myvid2.mp4')
  success,image = vidcap.read()
  count = 0;
  print "I am in success"
  while success:
    success,image = vidcap.read()
    resize = cv2.resize(image, (640, 480)) 
    cv2.imwrite("%03d.jpg" % count, resize)     
    if cv2.waitKey(10) == 27:                     
        break
    count += 1
  </code></pre>
  
  <p>I am working with video and am dividing the video into individual frames, as a .jpg images. I am also at the same time resizing the frames to dimension 640x480. The order of the frames is also being preserved. The only issue with the code is that it does not save the previous image-ratio.</p>
  
  <p>For example how it look's like, resize from 1920x1080:
  <a href="https://i.stack.imgur.com/FeO0E.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/FeO0E.jpg" alt="Resized image by pure code"></a></p>
  
  <p>There is a problem in ratio, as you can see. 1920x1080 16:9, but 640:480 4:3</p>
  
  <p>How I ideally want it to be: 
  <a href="https://i.stack.imgur.com/7TimO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7TimO.png" alt="Resized image in ideal code"></a></p>
  
  <p>Thank you for your taking the time for reading the question. I will be very glad if you can help me solve this issue~
  Have a good day, my friend.</p>