Repository navigation
Add optional Python and NumPy bindings - #171
Merged
Merged
Conversation
danoli3
force-pushed
the
feat/python-numpy
branch
from
October 15, 2026 05:03
0f9cec0 to
cdd06c9
Compare
This was referenced Oct 15, 2026
danoli3
force-pushed
the
feat/python-numpy
branch
from
October 15, 2026 05:56
cdd06c9 to
d44caaf
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add optional Python/NumPy bindings as a separately built package under bindings/python, inspired by FreeImageRe's Python interface. Use ctypes against an installed shared FreeImage library, without adding Python dependencies to the core C/C++ build or copying the interpreter integration.
Provide load/loadf/save and load_bytes/save_bytes with owned top-down RGB/RGBA arrays. Support native-endian uint8/uint16/float32 and scalar float64, palettes/indexed transparency, sliced/reversed arrays, Unicode Windows paths, and clean exceptions. Reject unsupported pixel types, CMYK, big-endian bitmap layouts and header-only arrays explicitly. Each operation frees its bitmap/memory stream; returned arrays never borrow freed library storage. Metadata-to-Python mapping is separate future work.
The package is opt-in, includes FreeImage's license texts, supports FREEIMAGE_LIBRARY overrides, and builds a pure-Python wheel without embedding native binaries. No PyPI publication is performed. Add Linux/macOS/Windows CI that builds a shared library, installs the package, runs tests and uploads a wheel artifact.
Validation: build the wheel locally, install it into an isolated target directory, and run the installed package's four test groups with NumPy 2.2.6. Cover exact RGB/RGBA/grayscale/HDR round trips, memory/file I/O, ownership/writability, noncontiguous/reversed arrays, Unicode filenames and invalid inputs.
PR stack
Depends on #170; base branch is
feat/image-analysis-tools. Top of stack.#165 → #166 → #167 → #168 → #169 → #170 → #171
Merge bottom-up. Each PR diff is relative to its predecessor. Combined stack validation passed locally: 10 CTest suites with ASan, 9 in a shared build, 6 with both optional codecs disabled, plus all four Python/NumPy test groups. GitHub CI reruns after the branch rewrite.