Skip to content

Rename manim.typing.Image type aliases to PixelArray to avoid conflict with PIL.Image #3851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
4 changes: 2 additions & 2 deletions manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@

from manim.typing import (
FunctionOverride,
Image,
ManimFloat,
ManimInt,
MappingFunction,
PathFuncType,
PixelArray,
Point3D,
Point3D_Array,
Vector3D,
Expand Down Expand Up @@ -825,7 +825,7 @@ def apply_over_attr_arrays(self, func: MappingFunction) -> Self:

# Displaying

def get_image(self, camera=None) -> Image:
def get_image(self, camera=None) -> PixelArray:
if camera is None:
from ..camera.camera import Camera

Expand Down
22 changes: 11 additions & 11 deletions manim/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
"FunctionOverride",
"PathFuncType",
"MappingFunction",
"Image",
"GrayscaleImage",
"RGBImage",
"RGBAImage",
"PixelArray",
"GrayscalePixelArray",
"RGBPixelArray",
"RGBAPixelArray",
"StrPath",
"StrOrBytesPath",
]
Expand Down Expand Up @@ -582,7 +582,7 @@
Image types
"""

Image: TypeAlias = npt.NDArray[ManimInt]
PixelArray: TypeAlias = npt.NDArray[ManimInt]
"""``shape: (height, width) | (height, width, 3) | (height, width, 4)``

A rasterized image with a height of ``height`` pixels and a width of
Expand All @@ -595,24 +595,24 @@
`RGBA_Array_Int`.
"""

GrayscaleImage: TypeAlias = Image
GrayscalePixelArray: TypeAlias = PixelArray
"""``shape: (height, width)``

A 100% opaque grayscale `Image`, where every pixel value is a
A 100% opaque grayscale `PixelArray`, where every pixel value is a
`ManimInt` indicating its lightness (black -> gray -> white).
"""

RGBImage: TypeAlias = Image
RGBPixelArray: TypeAlias = PixelArray
"""``shape: (height, width, 3)``

A 100% opaque `Image` in color, where every pixel value is an
A 100% opaque `PixelArray` in color, where every pixel value is an
`RGB_Array_Int` object.
"""

RGBAImage: TypeAlias = Image
RGBAPixelArray: TypeAlias = PixelArray
"""``shape: (height, width, 4)``

An `Image` in color where pixels can be transparent. Every pixel
A `PixelArray` in color where pixels can be transparent. Every pixel
value is an `RGBA_Array_Int` object.
"""

Expand Down
Loading