Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions manim/mobject/types/image_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@
)
from ...utils.images import change_to_rgba_array, get_full_raster_image_path

__all__ = ["ImageMobject", "ImageMobjectFromCamera"]

if TYPE_CHECKING:
from typing import Self

import numpy.typing as npt

from manim.typing import PixelArray, StrPath

from ...camera.moving_camera import MovingCamera


class AbstractImageMobject(Mobject):
"""
Expand Down Expand Up @@ -216,6 +212,10 @@ def get_pixel_array(self) -> PixelArray:
"""A simple getter method."""
return self.pixel_array

def init_colors(self) -> None:
"""Override base init_colors to avoid overwriting image pixels during init."""
return None

def set_color( # type: ignore[override]
self,
color: ParsableManimColor = YELLOW_C,
Expand Down
2 changes: 1 addition & 1 deletion tests/module/mobject/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@pytest.mark.parametrize("dtype", [np.uint8, np.uint16])
def test_invert_image(dtype):
rng = np.random.default_rng()
array = (255 * rng.random((10, 10, 4))).astype(dtype)
array = (np.iinfo(dtype).max * rng.random((10, 10, 4))).astype(dtype)
image = ImageMobject(array, pixel_array_dtype=dtype, invert=True)
assert image.pixel_array.dtype == dtype

Expand Down