Skip to content

"ValueError: unknown raw mode for given image mode" when loading TIFF #8636

@conceptfarm

Description

@conceptfarm

What did you do?

I am trying to resize a tiff file with an alpha channel

What did you expect to happen?

Have a resized image

What actually happened?

I got a ValueError: unknown raw mode for given image mode error

What are your OS, Python and Pillow versions?

  • OS: Windows 10 21H2
  • Python: 3.10.6
  • Pillow: 11.1.0
python3 -m PIL.report

--------------------------------------------------------------------
Pillow 11.0.0
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
--------------------------------------------------------------------
Python executable is C:\Python3106\python.exe
System Python files loaded from C:\Python3106
--------------------------------------------------------------------
Python Pillow modules loaded from C:\Python3106\lib\site-packages\PIL
Binary Pillow modules loaded from C:\Python3106\lib\site-packages\PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.0.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.3
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- JPEG support ok, compiled for libjpeg-turbo 3.0.4
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
*** XCB (X protocol) support not installed
--------------------------------------------------------------------
from PIL import Image
file = r'c:\temp\test.tif'
imgObject = Image.open(file)
outImageObject = imgObject.resize((800, 800))

Traceback of the error :

Traceback (most recent call last):
  File "c:\Python38\Projects\poliigonBrowser_v2.4\test3.py", line 20, in <module>
    outImageObject = imgObject.resize((800, 800))
  File "C:\Python3106\lib\site-packages\PIL\Image.py", line 2335, in resize
    return self.copy()
  File "C:\Python3106\lib\site-packages\PIL\Image.py", line 1282, in copy
    self.load()
  File "C:\Python3106\lib\site-packages\PIL\TiffImagePlugin.py", line 1277, in load
    return self._load_libtiff()
  File "C:\Python3106\lib\site-packages\PIL\TiffImagePlugin.py", line 1345, in _load_libtiff
    decoder = Image._getdecoder(self.mode, "libtiff", args, self.decoderconfig)
  File "C:\Python3106\lib\site-packages\PIL\Image.py", line 442, in _getdecoder
    return decoder(mode, *args + extra)
ValueError: unknown raw mode for given image mode

Link to the image to reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions