uploadcare / pillow-simd

The friendly PIL fork
https://python-pillow.github.io/pillow-perf/
Other
2.12k stars 85 forks source link

[Question] Use libImaging from other languages? #126

Closed vedantroy closed 1 year ago

vedantroy commented 1 year ago

I'm wondering if it is possible to use the underlying libImaging library from other languages. For example, the Rust ecosystem doesn't really have a simple image augmentation library, and pillow-simd could be a good fit.

From a cursory glance, it seems like libImaging does not have any dependency on the Python header file, so it should be possible to call this from Rust.

hugovk commented 1 year ago

I can't speak for the Pillow-SIMD fork, but for upstream Pillow, only the Python API is supported. The C API is private and internal, and we can and do make "breaking" changes with no warning; the C code shouldn't be called directly, only via Python.

See for example https://github.com/python-pillow/Pillow/issues/4532.

vedantroy commented 1 year ago

I can't speak for the Pillow-SIMD fork, but for upstream Pillow, only the Python API is supported. The C API is private and internal, and we can and do make "breaking" changes with no warning; the C code shouldn't be called directly, only via Python.

See for example python-pillow#4532.

Thanks for the response. I'm not too worried about official support, I'm more just interested in making sure it is technically feasible to do so without rewriting large amounts of C code. From the look of it, extracting libImaging looks possible.

homm commented 1 year ago

Duplicate of #32