简体   繁体   English

如何使用Python PIL或Pillow创建/分割多帧TIFF图像?

[英]How to create/split multiple frame TIFF image using Python PIL or Pillow?

PIL has seek(frame) function to seek through multi frame file and tell() function to return the current frame number. PIL具有seek(frame)函数以搜索多帧文件,并tell()函数返回当前帧号。
Is it possible to create such multiple frame TIFF image using PIL or Pillow (or using any other library)? 是否可以使用PIL或Pillow(或使用任何其他库)创建这种多帧TIFF图像?

scikit-image and numpy packages can be used. 可以使用scikit-image和numpy软件包。
For example: 例如:

import from skimage.io import imread, imsave
from numpy import *

im = imread("fileName.tiff")
im_array = array_split(im, 2, axis=3) # dividing the array into 2 parts along the 3rd axis
imsave("part1.tiff", im_array[0])
imsave("part2.tiff", im_array[1])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM