Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Pillow was giving some troubles with creating an image from an array while setting a mode

Grant Sanderson978e7c179924
diff --git a/camera/camera.py b/camera/camera.py
index bf06bd7fb..b62f847f3 100644
--- a/camera/camera.py
+++ b/camera/camera.py
@@ -606,7 +606,8 @@ class BackgroundColoredVMobjectDisplayer(object):
new_width, new_height,
mode="RGBA"
):
- image = Image.fromarray(background_array, mode=mode)
+ image = Image.fromarray(background_array)
+ image = image.convert(mode)
resized_image = image.resize((new_width, new_height))
return np.array(resized_image)