Open amdepott opened 2 years ago
Just an explanation from the code.
https://github.com/python-pillow/Pillow/blob/1f5be894b91a00731ca328b3352eaf69eaee766c/src/libImaging/Filter.c#L326-L332
means that it doesn't support I
, I;*
, F
or BGR;*
.
PR #7108 has been merged, fixing this for I mode.
Hi!
When I use ImageFilter
to performs a look-up table (LUT) transform on an image of mode I
or I;16
,
File ".../PIL/ImageFilter.py", line 560, in filter
return image.color_lut_3d(
ValueError: image has wrong mode
still occurred.
I found that I mode has been supported for BuiltinFilter
but still not supported for Color3DLUT
.
Related code:
https://github.com/python-pillow/Pillow/blob/main/src/libImaging/ColorLUT.c#L89-L92
Would mode I
be supported for Color3DLUT
in the future?
I don't see how a function that "transforms 3-channel pixels" applies to a 1 channel image.
Could you describe in more detail what you are trying to do?
Thanks for your reply.
I'm sorry, I misunderstood.
I thought mode I
supported 3-channel 32-bit images, however it only supports 1-channel.
I am trying to perform a look-up table (LUT) transform on heif images which are in 10-bit & 3-channel. Now I find that Pillow only supports 8-bit color depth for 3-channel images (<- Am I right?), so the only way is to convert the 10-bit images to 8-bit in advance, even though it will reduce the amount of color information.
Now I find that Pillow only supports 8-bit color depth for 3-channel images
Yes, see #1888
so the only way is to convert the 10-bit images to 8-bit in advance, even though it will reduce the amount of color information.
If your goal is to use the final image with Pillow, then yes. If your goal is to use the final image with something else, then I suppose you would split 10-bit 3-channel images to 3 10-bit 1-channel images in advance, then use Pillow to handle the LUT, and then merge the images again outside of Pillow.
If your goal is to use the final image with something else, then I suppose you would split 10-bit 3-channel images to 3 10-bit 1-channel images in advance, then use Pillow to handle the LUT, and then merge the images again outside of Pillow.
Oh! Thanks for your suggestion!
split 10-bit 3-channel images to 3 10-bit 1-channel images in advance, then use Pillow to handle the LUT
Again, this wouldn't 3D LUT, this will be three 1D LUTs.
Still does not work on I;16 Also does not work with gaussian blur filters
ImageFilter.BLUR
. Pillow 11 is due to be released in a week with this feature.
What did you do?
Attempted to use Image.filter(ImageFilter.BLUR) on an image of mode I or I;16
What did you expect to happen?
Image is blurred
What actually happened?
Code throws ValueError
What are your OS, Python and Pillow versions?