Resize Image And Keep Aspect Ratio Python. Open someimage jpg wpercent mywidth float img. Opencv provides us number of interpolation methods to resize the image.
Resize an image and keep aspect ratio posted by twig at 8 36 am monday january 14 2013 a handy little snippet that saves you a lot of work is the ability to quickly generate thumbnails from a source image. It does this by determining what percentage 300 pixels is of the original width img size 0 and then multiplying the original height img size 1 by that percentage. Set mywidth to the desired with in pixels.
This script will resize an image somepic jpg using pil python imaging library to a width of 300 pixels and a height proportional to the new width.
Resize an image and keep aspect ratio posted by twig at 8 36 am monday january 14 2013 a handy little snippet that saves you a lot of work is the ability to quickly generate thumbnails from a source image. To resize image in python opencv cv2 resize can be used. Resize mywidth hsize pil. This script will resize an image somepic jpg using pil python imaging library to a width of 300 pixels and a height proportional to the new width.