Skip to content

[Experimental] Fix image test#4618

Open
fmuenkel wants to merge 2 commits intoManimCommunity:experimentalfrom
fmuenkel:fix-image-test
Open

[Experimental] Fix image test#4618
fmuenkel wants to merge 2 commits intoManimCommunity:experimentalfrom
fmuenkel:fix-image-test

Conversation

@fmuenkel
Copy link
Contributor

@fmuenkel fmuenkel commented Mar 1, 2026

Overview: What does this pull request change?

Fixes test_invert_image in tests/module/mobject/test_image.py by overriding ImageMobject.init_colors().
Progress towards completing #4592.

Motivation and Explanation: Why and how do your changes improve the library?

The base OpenGLMobject.__init__ calls init_colors() which in turn calls set_color(). Because init_colors() runs after ImageMobject inverts the image, the inverted values in the pixel array are overwritten.

Furthermore, the test now select from the full range of values for 16 bit colors.

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Copy link
Member

@chopan050 chopan050 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! This is the first step towards rendering ImageMobjects in OpenGL, very much needed.

For the record, PR #4233 rewrites the color system so that only VMobjects have a color (because it does not make sense that pure, non-renderable Mobjects have a color). Among the changes, it removes init_colors(), so it's good to note this PR in #4233.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants