Crashes when trying to write a 4 channel (RGBA) image.
(Three channel images work though)
This is particularly annoying since reading even a non-alpha PNG image via PIL produces a 4-channel image, causing even the simplest conversion such as Image.open('src.png').save('dst.jxl') to run into this crash.
To reproduce
from PIL import Image
import pillow_jxl
import numpy as np
rgba = np.zeros((256, 256, 4), dtype='uint8')
Image.fromarray(rgba).save('out.jxl')
Error:
thread '<unnamed>' panicked at src\lib.rs:76:59:
called `Result::unwrap()` on an `Err` value: ApiUsage
stack backtrace:
0: rust_begin_unwind
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\core\src/panicking.rs:72:14
2: core::result::unwrap_failed
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\core\src/result.rs:1653:5
3: pillow_jxl::Encoder::__call__
4: pillow_jxl::_::<impl pillow_jxl::Encoder>::__pymethod___call____
5: pyo3::impl_::trampoline::trampoline
6: pillow_jxl::_::<impl pyo3::impl_::pyclass::PyMethods<pillow_jxl::Encoder> for pyo3::impl_::pyclass::PyClassImplCollector<pillow_jxl::Encoder>>::py_methods::ITEMS::trampoline
7: <unknown>
8: <unknown>
...
Crashes when trying to write a 4 channel (RGBA) image. (Three channel images work though)
This is particularly annoying since reading even a non-alpha PNG image via PIL produces a 4-channel image, causing even the simplest conversion such as
Image.open('src.png').save('dst.jxl')
to run into this crash.To reproduce
Error:
Alternative reproduction using docker
Dockerfile.txt
System information
Also verified as failing the same way on linux.