/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def resize(im,percent): """ retaille suivant un pourcentage 'percent' """ w,h = im.size return im.resize(((percent*w)/100,(percent*h)/100)) def resize2(im,pixels): """ retaille le coté le plus long en 'pixels' (pour tenir dans une frame de pixels x pixels) """ (wx,wy) = im.size rx=1.0*wx/pixels ry=1.0*wy/pixels if rx>ry: rr=rx else: rr=ry return im.resize((int(wx/rr), int(wy/rr)))
Comments
