Tor*_*erg 7 python zipfile python-imaging-library pillow
我可以使用PIL/Pillow打开拉链内的图像而不先将其提取到磁盘吗?
jfs*_*jfs 11
最近的Pillow发布不需要.seek():
#!/usr/bin/env python
import sys
from zipfile import ZipFile
from PIL import Image # $ pip install pillow
filename = sys.argv[1]
with ZipFile(filename) as archive:
for entry in archive.infolist():
with archive.open(entry) as file:
img = Image.open(file)
print(img.size, img.mode, len(img.getdata()))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5996 次 |
| 最近记录: |