Answers
提供一个解决方案吧 可以转tiff文件里的多张文件
from libtiff import TIFF
from wand.image import Image
from sys import argv
import os.path
if len(argv)!=2:
print 'Uage:python tif.py [tifname]'
exit()
filename, ext = os.path.splitext(argv[1])
if ext != '.tif':
print 'Must be a tif file'
exit()
tif = TIFF.open(argv[1])
for index, ima in enumerate(tif.iter_images()):
img_name = '%s[%d]' % (argv[1], index)
im = Image(filename=img_name)
im.format = 'jpg'
im.save(filename='%s%d.jpg' % (filename, index))
print 'done-%d' % index
print 'all-done'
可爱的梨梨花
answered 11 years, 10 months ago