pillow1.py 490 B

1234567891011121314151617181920212223
  1. """
  2. 使用pillow操作图像
  3. Version: 0.1
  4. Author: 骆昊
  5. Date: 2018-03-26
  6. """
  7. from PIL import Image
  8. img = Image.open('./res/guido.jpg')
  9. print(img.size)
  10. print(img.format)
  11. print(img.format_description)
  12. img.save('./res/guido.png')
  13. img2 = Image.open('./res/guido.png')
  14. img3 = img2.crop((335, 435, 430, 615))
  15. for x in range(4):
  16. for y in range(5):
  17. img2.paste(img3, (95 * y , 180 * x))
  18. img2.resize((img.size[0] // 2, img.size[1] // 2))
  19. img2.rotate(90)
  20. img2.save('./res/guido2.png')