- 安裝PIL模組。
- 加入下面程式碼。
from PIL import Image
# pick an image file you have in the working directory
# (or give full path name)
image_file = "D:\My Documents\My Pictures\Costa Rican Frog.jpg"
img = Image.open(image_file)
# get the image's width and height in pixels
width, height = img.size
print width
print height
沒有留言:
張貼留言