python PIL从单个图像文件访问多个图像

时间:2013-10-22 12:10:11

标签: python image python-imaging-library

我已经为Delta压缩图像编写了一个python脚本。图像文件格式为.tif,包含8个图像。当我使用普通代码时......

org_Image = Image.open(image)
org_Data = org_Image.load()

...我只能访问第一张图片。我如何访问其他的?

1 个答案:

答案 0 :(得分:2)

您使用org_Image.seek(org_Image.tell() + 1)来获取下一个。

在PIL中seek将您移动到给定的帧(如果不存在则带有IO_Error),并告诉reports当前帧编号。