我有一些tiff图像,有7-8个级别。这些是使用vips生成的。我已经尝试了this stackoverflow question上列出的迭代。我也尝试过这个:
im = Image.open("E:\\tiled_pyr.tif")
for i in range(7):
try:
im.seek(i)
print im.size[0]
print im.size[1]
except EOFError:
# Not enough frames in im
break
然而,当我开始迭代时,我得到了这个错误:
IOError: decoder tiff_adobe_deflate not available
我想做的是在最高分辨率或最高水平上裁剪ptif,然后对该裁剪进行一些分析。
使用PIL可以做到这一点吗?我还需要别的什么吗?谢谢!
发布于 2015-05-22 20:59:39
libvips Python绑定pyvips现在可以在Windows上运行,因此您可以执行以下操作:
import pyvips
# this will open the highest resolution layer
image = pyvips.Image.new_from_file("somefile.tif")
# crop out an area
area = image.crop(x, y, w, h)
# ... do what you like
print('average pixel value of crop is', area.avg())
看见
https://stackoverflow.com/questions/24499316
复制相似问题