Repository navigation
Make OpenCV a core dependency, encode RGBA PNG, bump to 0.4.0 - #15
Merged
Merged
Conversation
- Drop the `images` extra; opencv-python-headless>=4.12 is now required. Its wheels require NumPy 2, so the NumPy floor and the glibc 2.17 minimum-NumPy check move to 2.0.2. cv2 stays lazily imported. - PngEncoder accepts 4-channel CHW (RGBA), symmetric with decode_image(mode="RGBA"). JpegEncoder still rejects 4 channels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAijSnAE4aAjuS1EcCTwqS
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.
Summary
imagesextra is gone (no alias);opencv-python-headless>=4.12is independencies.cv2is still imported lazily on first image-codec use;_opencv.pydrops the "installtensorcodec[images]" message and keeps only the 4.12 version check.opencv-python-headless4.12+ wheel requiresnumpy>=2on Python 3.9+, sonumpy>=1.26could no longer be satisfied.tensorcodecnow declaresnumpy>=2, and the glibc 2.17 release check pins cp310 to NumPy 2.0.2 (the oldest NumPy 2 with cp310 manylinux2014 wheels) instead of 1.26.4.tensorcodec-avalone keepsnumpy>=1.26.PngEncoderaccepts 4-channel CHW uint8 and converts RGBA→BGRA for OpenCV, so alpha is kept.JpegEncoderstill allows only 1 or 3 channels; with 4 it raisesValueError: JpegEncoder needs a nonempty CHW uint8 array with 1/3 channels.decode_image(..., mode="RGBA")(or"UNCHANGED") returns 4×H×W RGBA with straight alpha last, which is exactly whatPngEncodertakes. The defaultmode="RGB"drops alpha without premultiplying.pyproject.toml(project andtensorcodec-avpin),av/Cargo.toml,av/Cargo.lock,src/tensorcodec/__init__.py, plusdocs/releasing.mdanddocs/system_ffmpeg.md. Not tagged or published. The repo has no changelog.docs/images.md,docs/package_size.md) and CI (build-python.ymlinstalls plaintensorcodec;build-av.ymlno longer installs OpenCV separately next to the wheels) are updated to match.Tests
test_png_rgba_round_trip: a random RGBA image with fully transparent pixels. It is read back exactly by Pillow, and bydecode_imageinRGBA/UNCHANGEDmode. Default RGB mode returns the first three channels unchanged.test_jpeg_rejects_alpha. Input-error cases now use 2 and 5 channels forPngEncoder.--compare) passes when run against the publishedtensorcodec-av0.3.0 wheel. To do that,__version__was temporarily set back to 0.3.0, because tensorcodec-av 0.4.0 does not exist yet and this PR does not touchav/sources.Notes
cv2variant (opencv-python, contrib). The pip metadata now pulls in the headless wheel, and the docs warn against mixing variants.🤖 Generated with Claude Code
https://claude.ai/code/session_01YAijSnAE4aAjuS1EcCTwqS