Repository: ManimCommunity/manim
File: manim/camera/camera.py (Python)

Code before:
    def resize_background_array_to_match(self, background_array, pixel_array):
        """Resizes the background array to match the passed pixel array.

        Parameters
        ----------
        background_array : np.array
            The prospective pixel array.
        pixel_array : np.array
            The pixel array whose width and height should be matched.

        Returns
        -------
        np.array
            The resized background array.
        """
        height, width = pixel_array.shape[:2]
        mode = "RGBA" if pixel_array.shape[2] == 4 else "RGB"
        return self.resize_background_array(background_array, width, height, mode)

    def get_background_array(self, image: Union[Image.Image, pathlib.Path, str]):
        """Gets the background array that has the passed file_name.

        Parameters
        ----------
        image
            The background image or its file_name.

        Returns
        -------
        np.ndarray
            The pixel array of the given image (file)
        """
        image_key = str(image)

        if image_key in self.file_name_to_pixel_array_map:
            return self.file_name_to_pixel_array_map[image_key]
        if isinstance(image, str):
            full_path = get_full_raster_image_path(image)
            image = Image.open(full_path)
        back_array = np.array(image)

        pixel_array = self.pixel_array
        if not np.all(pixel_array.shape == back_array.shape):
            back_array = self.resize_background_array_to_match(back_array, pixel_array)

        self.file_name_to_pixel_array_map[image_key] = back_array
        return back_array

    def display(self, *cvmobjects):
        """Displays the colored VMobjects.


Review comment (suggestion):
```suggestion
            The background image or its file name.
```

Code after:
    def resize_background_array_to_match(self, background_array, pixel_array):
        """Resizes the background array to match the passed pixel array.

        Parameters
        ----------
        background_array : np.array
            The prospective pixel array.
        pixel_array : np.array
            The pixel array whose width and height should be matched.

        Returns
        -------
        np.array
            The resized background array.
        """
        height, width = pixel_array.shape[:2]
        mode = "RGBA" if pixel_array.shape[2] == 4 else "RGB"
        return self.resize_background_array(background_array, width, height, mode)

    def get_background_array(self, image: Union[Image.Image, pathlib.Path, str]):
        """Gets the background array that has the passed file_name.

        Parameters
        ----------
        image
            The background image or its file name.

        Returns
        -------
        np.ndarray
            The pixel array of the image.
        """
        image_key = str(image)

        if image_key in self.file_name_to_pixel_array_map:
            return self.file_name_to_pixel_array_map[image_key]
        if isinstance(image, str):
            full_path = get_full_raster_image_path(image)
            image = Image.open(full_path)
        back_array = np.array(image)

        pixel_array = self.pixel_array
        if not np.all(pixel_array.shape == back_array.shape):
            back_array = self.resize_background_array_to_match(back_array, pixel_array)

        self.file_name_to_pixel_array_map[image_key] = back_array
        return back_array

    def display(self, *cvmobjects):
        """Displays the colored VMobjects.