ClearCode

Basics

May 18th, 2022
2,339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. from PIL import Image
  2.  
  3. # create new image by import
  4. image = Image.open('picture.jpg')
  5.  
  6. # alternative way to import an image
  7. # with Image.open('picture.jpg') as image:
  8. #   image.show()
  9.  
  10. # create a new image from scratch
  11. image_blank = Image.new('RGBA',(1000,600))
  12.  
  13. # show the picture
  14. # image_blank.show()
  15.  
  16. # saving the picture
  17. #image.save('test_save.png')
  18.  
  19. # image information
  20. print(image.size)
  21. print(image.filename)
  22. print(image.format)
  23. print(image.format_description)
Advertisement
Add Comment
Please, Sign In to add comment