Skip to content

PIL fails to roundtrip some TIFF images #1039

@anntzer

Description

@anntzer

For some TIFF images, a simple Image.open(path).save(path) fails with the following:

_TIFFVSetField: /path/to/test.tiff: Bad value 2 for "ExtraSamples" tag.
Traceback (most recent call last):
  <elided traceback>
  File "/usr/lib/python3.4/site-packages/PIL/Image.py", line 1685, in save
    save_handler(self, fp, filename)
  File "/usr/lib/python3.4/site-packages/PIL/TiffImagePlugin.py", line 1185, in _save
    e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
  File "/usr/lib/python3.4/site-packages/PIL/Image.py", line 430, in _getencoder
    return encoder(mode, *args + extra)
RuntimeError: Error setting from dictionary

The image was created using Qt's QImageWriter (from a QImage.Format_RBG32 image), but it is not clear how to reproduce the issue as a simple blank image created in the same way does not trigger the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.TIFF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions