-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Here is a 16-bit grayscale image:
It clearly contains a gradient of grays.
If I open it with Pillow, convert it to 8-bit grayscale, and save it, like so...
>>> from PIL import Image
>>> test_img = Image.open('test.png')
>>> test_img.mode
'I'
>>> test_img.convert('L').save('out.png')
... then I get this, which is mostly completely white:
This conversion should work; according to http://pillow.readthedocs.io/en/4.2.x/handbook/tutorial.html#converting-between-modes
The library supports transformations between each supported mode and the “L” and “RGB” modes.
and according to http://pillow.readthedocs.io/en/latest/handbook/concepts.html#modes, I
is a supported mode.
Notably, I don't see this same problem if I start by loading an 8-bit RGB image from a JPG and then do .convert('I').convert('L')
, so it's not simply the case that I
->L
conversion is broken in general. I'm not what specifically leads to the breakage in this case.