Python 影像庫/檔案 I/O
外觀
PIL 中的檔案操作非常簡單,並且反映了正常的 Python 方法。
| 本頁或本節是未開發的草稿或提綱。 您可以幫助開發這項工作,或者您可以在專案室尋求幫助。 |
import Image
img = Image.open(filepath)
from PIL import Image
img = Image.open("path/to/image.ext")
pixels = img.load() # Load the pixels of the image into a matrix
在視窗中顯示指定影像的副本。
from PIL import Image
img = Image.open("path/to/image.ext")
img.show() # Shows the image in a new window
import Image
img = Image.open(filepath)
img.save("example.png")
#img.save(outfile, options...)
#img.save(outfile, format, options...)