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В PšY JMPI \YРRK Qɨ] XɴRL FЀRK


          TLš˜RK XLиG  save(path, type)   :ɴ Hд





           ...

           im.save('photo_new.jpg', 'JPEG')






               8ϰS XLYQFREMP





          7м HдRK TLš˜RK 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
   48   49   50   51   52   53   54   55   56   57   58