Skip to content

Instantly share code, notes, and snippets.

@ochilab
Created July 18, 2017 07:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochilab/962483a0c240133961c40de60b1d0aae to your computer and use it in GitHub Desktop.
Save ochilab/962483a0c240133961c40de60b1d0aae to your computer and use it in GitHub Desktop.
Python:マルチページTIFFを読み込んで1ページずつ処理する
from PIL import Image
# Tiff画像を読み込む
image = Image.open('C:\\Users\\ochi\\temp\\sample2.tif')
#ページ数を求める
fLength =image.n_frames
#1ページずつ抜き出して処理
for i in range(0,fLength+1):
image.seek(1)
sImg =image.copy()
# 以下で何らかの処理
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment