Package: src:manim-ce
Version: 0.21.0-1
Severity: serious
Tags: sid forky

autopkg test failure seen with pillow 13.0.0:

[...]
271s =================================== FAILURES =================================== 271s ______________________________ test_ImageMobject _______________________________
271s
271s scene = <manim.utils.testing._test_class_makers._make_test_scene_class.<locals>._TestedScene object at 0x7f60bda22270>
271s
271s     @frames_comparison
271s     def test_ImageMobject(scene):
271s         file_path = get_svg_resource("tree_img_640x351.png")
271s         im1 = ImageMobject(file_path).shift(4 * LEFT + UP)
271s im2 = ImageMobject(file_path, scale_to_resolution=1080).shift(4 * LEFT + 2 * DOWN) 271s im3 = ImageMobject(file_path, scale_to_resolution=540).shift(4 * RIGHT)
271s         scene.add(im1, im2, im3)
271s >       scene.wait(1)
271s
271s tests/test_graphical_units/test_img_and_svg.py:263:
271s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
271s /usr/lib/python3/dist-packages/manim/scene/scene.py:1250: in wait
271s     self.play(
271s /usr/lib/python3/dist-packages/manim/scene/scene.py:1207: in play
271s     self.renderer.play(self, *args, **kwargs)
271s /usr/lib/python3/dist-packages/manim/renderer/cairo_renderer.py:110: in play
271s     self.save_static_frame_data(scene, scene.static_mobjects)
271s /usr/lib/python3/dist-packages/manim/renderer/cairo_renderer.py:241: in save_static_frame_data
271s     self.update_frame(scene, mobjects=static_mobjects)
271s /usr/lib/python3/dist-packages/manim/renderer/cairo_renderer.py:159: in update_frame
271s     self.camera.capture_mobjects(mobjects, **kwargs)
271s /usr/lib/python3/dist-packages/manim/camera/camera.py:556: in capture_mobjects
271s     self.display_funcs[group_type](list(group), self.pixel_array)
271s /usr/lib/python3/dist-packages/manim/camera/camera.py:1032: in display_multiple_image_mobjects
271s     self.display_image_mobject(image_mobject, pixel_array)
271s /usr/lib/python3/dist-packages/manim/camera/camera.py:1130: in display_image_mobject
271s     full_image = Image.fromarray(
271s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
271s
271s obj = array([[0., 0., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.],
271s     ...., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.]], shape=(480, 854))
271s mode = 'RGBA'
271s
271s def fromarray(obj: SupportsArrayInterface, mode: str | None = None) -> Image:
271s         """
271s Creates an image memory from an object exporting the array interface
271s         (using the buffer protocol)::
271s
271s           from PIL import Image
271s           import numpy as np
271s           a = np.zeros((5, 5))
271s           im = Image.fromarray(a)
271s
271s If ``obj`` is not contiguous, then the ``tobytes`` method is called
271s         and :py:func:`~PIL.Image.frombuffer` is used.
271s
271s In the case of NumPy, be aware that Pillow modes do not always correspond 271s to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels,
271s         32-bit signed integer pixels, and 32-bit floating point pixels.
271s
271s         Pillow images can also be converted to arrays::
271s
271s           from PIL import Image
271s           import numpy as np
271s           im = Image.open("hopper.jpg")
271s           a = np.asarray(im)
271s
271s When converting Pillow images to arrays however, only pixel values are 271s transferred. This means that P and PA mode images will lose their palette.
271s
271s         :param obj: Object with array interface
271s :param mode: Optional mode to use when reading ``obj``. Since pixel values do not 271s contain information about palettes or color spaces, this can be used to place 271s grayscale L mode data within a P mode image, or read RGB data as YCbCr for
271s           example.
271s
271s See: :ref:`concept-modes` for general information about modes.
271s         :returns: An image object.
271s
271s         .. versionadded:: 1.1.6
271s         """
271s         arr = obj.__array_interface__
271s         shape = arr["shape"]
271s         ndim = len(shape)
271s         strides = arr.get("strides", None)
271s         try:
271s             typekey = (1, 1) + shape[2:], arr["typestr"]
271s         except KeyError as e:
271s             if mode is not None:
271s                 typekey = None
271s                 color_modes: list[str] = []
271s             else:
271s                 msg = "Cannot handle this data type"
271s                 raise TypeError(msg) from e
271s         if typekey is not None:
271s             try:
271s typemode, rawmode, color_modes = _fromarray_typemap[typekey]
271s             except KeyError as e:
271s                 typekey_shape, typestr = typekey
271s msg = f"Cannot handle this data type: {typekey_shape}, {typestr}"
271s                 raise TypeError(msg) from e
271s         if mode is not None:
271s             if mode != typemode and mode not in color_modes:
271s                 msg = "Invalid mode for data type"
271s >               raise ValueError(msg)
271s E               ValueError: Invalid mode for data type
271s
271s /usr/lib/python3/dist-packages/PIL/Image.py:3451: ValueError
271s ----------------------------- Captured stdout call ----------------------------- 271s INFO Reading config file: utils.py:124 271s /usr/lib/python3/dist-packages/manim/_ 271s config/default.cfg 271s INFO Reading config file: utils.py:131 271s /usr/lib/python3/dist-packages/manim/u 271s tils/testing/config_graphical_tests_mo 271s noframe.cfg 271s INFO Caching disabled. cairo_renderer.py:81 271s ------------------------------ Captured log call ------------------------------- 271s INFO manim:utils.py:124 Reading config file: /usr/lib/python3/dist-packages/manim/_config/default.cfg 271s INFO manim:utils.py:131 Reading config file: /usr/lib/python3/dist-packages/manim/utils/testing/config_graphical_tests_monoframe.cfg
271s INFO     manim:cairo_renderer.py:81 Caching disabled.
271s ___________________________ test_ImageInterpolation ____________________________
271s
271s scene = <manim.utils.testing._test_class_makers._make_test_scene_class.<locals>._TestedScene object at 0x7f60bda23770>
271s
271s     @frames_comparison
271s     def test_ImageInterpolation(scene):
271s         img = ImageMobject(
271s np.uint8([[63, 0, 0, 0], [0, 127, 0, 0], [0, 0, 191, 0], [0, 0, 0, 255]]),
271s         )
271s         img.height = 3
271s
271s         algorithm_texts = ["nearest", "linear", "cubic"]
271s         for i, algorithm_text in enumerate(algorithm_texts):
271s             algorithm = RESAMPLING_ALGORITHMS[algorithm_text]
271s             img_copy = img.copy().set_resampling_algorithm(algorithm)
271s position = img.height * (i - (len(algorithm_texts) - 1) / 2) * RIGHT
271s             img_copy.move_to(position)
271s             scene.add(img_copy)
271s
271s >       scene.wait()
271s
271s tests/test_graphical_units/test_img_and_svg.py:281:
271s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
271s /usr/lib/python3/dist-packages/manim/scene/scene.py:1250: in wait
271s     self.play(
271s /usr/lib/python3/dist-packages/manim/scene/scene.py:1207: in play
271s     self.renderer.play(self, *args, **kwargs)
271s /usr/lib/python3/dist-packages/manim/renderer/cairo_renderer.py:110: in play
271s     self.save_static_frame_data(scene, scene.static_mobjects)
271s /usr/lib/python3/dist-packages/manim/renderer/cairo_renderer.py:241: in save_static_frame_data
271s     self.update_frame(scene, mobjects=static_mobjects)
271s /usr/lib/python3/dist-packages/manim/renderer/cairo_renderer.py:159: in update_frame
271s     self.camera.capture_mobjects(mobjects, **kwargs)
271s /usr/lib/python3/dist-packages/manim/camera/camera.py:556: in capture_mobjects
271s     self.display_funcs[group_type](list(group), self.pixel_array)
271s /usr/lib/python3/dist-packages/manim/camera/camera.py:1032: in display_multiple_image_mobjects
271s     self.display_image_mobject(image_mobject, pixel_array)
271s /usr/lib/python3/dist-packages/manim/camera/camera.py:1130: in display_image_mobject
271s     full_image = Image.fromarray(
271s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
271s
271s obj = array([[0., 0., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.],
271s     ...., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.],
271s        [0., 0., 0., ..., 0., 0., 0.]], shape=(480, 854))
271s mode = 'RGBA'
271s
271s def fromarray(obj: SupportsArrayInterface, mode: str | None = None) -> Image:
271s         """
271s Creates an image memory from an object exporting the array interface
271s         (using the buffer protocol)::
271s
271s           from PIL import Image
271s           import numpy as np
271s           a = np.zeros((5, 5))
271s           im = Image.fromarray(a)
271s
271s If ``obj`` is not contiguous, then the ``tobytes`` method is called
271s         and :py:func:`~PIL.Image.frombuffer` is used.
271s
271s In the case of NumPy, be aware that Pillow modes do not always correspond 271s to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels,
271s         32-bit signed integer pixels, and 32-bit floating point pixels.
271s
271s         Pillow images can also be converted to arrays::
271s
271s           from PIL import Image
271s           import numpy as np
271s           im = Image.open("hopper.jpg")
271s           a = np.asarray(im)
271s
271s When converting Pillow images to arrays however, only pixel values are 271s transferred. This means that P and PA mode images will lose their palette.
271s
271s         :param obj: Object with array interface
271s :param mode: Optional mode to use when reading ``obj``. Since pixel values do not 271s contain information about palettes or color spaces, this can be used to place 271s grayscale L mode data within a P mode image, or read RGB data as YCbCr for
271s           example.
271s
271s See: :ref:`concept-modes` for general information about modes.
271s         :returns: An image object.
271s
271s         .. versionadded:: 1.1.6
271s         """
271s         arr = obj.__array_interface__
271s         shape = arr["shape"]
271s         ndim = len(shape)
271s         strides = arr.get("strides", None)
271s         try:
271s             typekey = (1, 1) + shape[2:], arr["typestr"]
271s         except KeyError as e:
271s             if mode is not None:
271s                 typekey = None
271s                 color_modes: list[str] = []
271s             else:
271s                 msg = "Cannot handle this data type"
271s                 raise TypeError(msg) from e
271s         if typekey is not None:
271s             try:
271s typemode, rawmode, color_modes = _fromarray_typemap[typekey]
271s             except KeyError as e:
271s                 typekey_shape, typestr = typekey
271s msg = f"Cannot handle this data type: {typekey_shape}, {typestr}"
271s                 raise TypeError(msg) from e
271s         if mode is not None:
271s             if mode != typemode and mode not in color_modes:
271s                 msg = "Invalid mode for data type"
271s >               raise ValueError(msg)
271s E               ValueError: Invalid mode for data type
271s
271s /usr/lib/python3/dist-packages/PIL/Image.py:3451: ValueError
271s ----------------------------- Captured stdout call ----------------------------- 271s INFO Reading config file: utils.py:124 271s /usr/lib/python3/dist-packages/manim/_ 271s config/default.cfg 271s INFO Reading config file: utils.py:131 271s /usr/lib/python3/dist-packages/manim/u 271s tils/testing/config_graphical_tests_mo 271s noframe.cfg 271s INFO Caching disabled. cairo_renderer.py:81 271s ------------------------------ Captured log call ------------------------------- 271s INFO manim:utils.py:124 Reading config file: /usr/lib/python3/dist-packages/manim/_config/default.cfg 271s INFO manim:utils.py:131 Reading config file: /usr/lib/python3/dist-packages/manim/utils/testing/config_graphical_tests_monoframe.cfg
271s INFO     manim:cairo_renderer.py:81 Caching disabled.

Reply via email to