crzcas

resolution image

Dec 29th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # Calculate the resolution of an image
  2. from PIL import Image
  3.  
  4. #im = Image.open('myimage.png') #path to image file
  5. im = Image.open('DR-2.3-smiley.bmp') #path to image file
  6. width, height = im.size
  7.  
  8. resolution = width * height
  9.  
  10. print("The image resolution is: ", width, " x ", height)
  11. print("The resolution is: ", resolution)
Advertisement
Add Comment
Please, Sign In to add comment