Popular Python recipes tagged "resize"http://code.activestate.com/recipes/langs/python/tags/resize/2011-02-20T22:36:39-08:00ActiveState Code Recipesscale rectangle while keeping aspect ratio (Python)
2011-02-20T22:36:39-08:00Romain Dartigueshttp://code.activestate.com/recipes/users/4167472/http://code.activestate.com/recipes/577575-scale-rectangle-while-keeping-aspect-ratio/
<p style="color: grey">
Python
recipe 577575
by <a href="/recipes/users/4167472/">Romain Dartigues</a>
(<a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/resize/">resize</a>, <a href="/recipes/tags/simple/">simple</a>).
Revision 2.
</p>
<p>Resize a rectangle (ie.: an image) while keeping the aspect ratio, without float.</p>
<p>You can scale up and down the proportions so the edges will be either <strong>at most</strong> or <strong>at least</strong> the given one.</p>