Python,PIL和libtiff问题

时间:2016-12-07 12:36:57

标签: python

当我在Python中执行常规PIL命令时,我收到如下错误消息:

 >>> im.save('layer_86_.tiff')
TIFFSetField: layer_86_.tiff: Unknown tag 33922.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 1685, in save
save_handler(self, fp, filename)
  File "C:\Python34\lib\site-packages\PIL\TiffImagePlugin.py", line 1185, in _save
    e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 430, in _getencoder
    return encoder(mode, *args + extra)

RuntimeError:字典中的错误设置

我在Github看到了类似的问题,可以追溯到很多年前。但在我的情况下,这个问题仍然可以复制。我甚至安装了libtiff.dll并将其放在System32和SysWOW64文件夹中,但无济于事。那么,我该如何解决呢?

这是另一条错误消息,我看到,当我尝试旋转图像时:

>>> from PIL import Image
>>> Image.MAX_IMAGE_PIXELS = 100000000000
>>> img = Image.open('layer_71_.tiff')
>>> img.rotate(80,expand=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 1603, in rotate
return self.transform((w, h), AFFINE, matrix, resample)
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 1862, in transform
im.__transformer((0, 0)+size, self, method, data, resample, fill)
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 1910, in __transformer

   image.load()
  File "C:\Python34\lib\site-packages\PIL\ImageFile.py", line 245, in load
    if not self.map and (not LOAD_TRUNCATED_IMAGES or t == 0) and e < 0:
TypeError: unorderable types: tuple() < int()

所以看起来PIL在很多情况下都不起作用。

0 个答案:

没有答案