Page 53 - Python Cơ Bản
P. 53
7EY OLM QЮ JMPI LɳRL XLɧRL GɺRK XLɳ Gɹ XLВ XLES XɨG XVɱR чРM
XвRK im
+LM JMPI
8к чРM XвRK Image Gɹ XLВ PY JMPI \YРRK Qɨ] XɴRL FЀRK
TLRK XLиG save(path, type) :ɴ Hд
...
im.save('photo_new.jpg', 'JPEG')
8ϰS XLYQFREMP
7м HдRK TLRK XLиG thumbnail RL WEY
from PIL import Image
im = Image.open('photo.jpg')
im.thumbnail((100, 100))
im.save('photo_thumbnail.jpg', 'JPEG')
thumbnail OLɺRK XVϲ ZА MQEKI QЪM Qɧ XLрG LMЖR XVɱR
SFNIGX MQEKI чERK KМM