Video editing with Python
Fix for `ColorClip.rotate()` (#1139)
Tom Burrowsb606067833d9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ae1215e1..0069aef8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- When using `VideoClip.write_videofile()` with `write_logfile=True`, errors would not be properly reported [#890]- `TextClip.list("color")` now returns a list of bytes, not strings [#1119]- `TextClip.search("colorname", "color")` does not crash with a TypeError [#1119]+- Using `rotate()` with a `ColorClip` no longer crashes [#1139]## [v1.0.2](https://github.com/zulko/moviepy/tree/v1.0.2) (2020-03-26)diff --git a/moviepy/video/fx/rotate.py b/moviepy/video/fx/rotate.pyindex e20623e7..3aeddba3 100644--- a/moviepy/video/fx/rotate.py+++ b/moviepy/video/fx/rotate.py@@ -8,8 +8,11 @@ try:PIL_FOUND = Truedef pil_rotater(pic, angle, resample, expand):+ # Ensures that pic is of the correct typereturn np.array(- Image.fromarray(pic).rotate(angle, expand=expand, resample=resample)+ Image.fromarray(np.array(pic).astype(np.uint8)).rotate(+ angle, expand=expand, resample=resample+ ))diff --git a/tests/test_fx.py b/tests/test_fx.pyindex eb46b5ba..8de4b6d2 100644--- a/tests/test_fx.py+++ b/tests/test_fx.py@@ -6,6 +6,7 @@ import pytestfrom moviepy.audio.fx.audio_normalize import audio_normalizefrom moviepy.audio.io.AudioFileClip import AudioFileClipfrom moviepy.utils import close_all_clips+from moviepy.video.VideoClip import ColorClipfrom moviepy.video.fx.blackwhite import blackwhite# from moviepy.video.fx.blink import blink@@ -216,6 +217,15 @@ def test_rotate():clip4 = rotate(clip, 360) # rotate 90 degreesassert clip4.size == tuple(clip.size)clip4.write_videofile(os.path.join(TMP_DIR, "rotate4.webm"))++ clip5 = rotate(clip, 50)+ clip5.write_videofile(os.path.join(TMP_DIR, "rotate5.webm"))++ # Test rotate with color clip+ clip = ColorClip([600, 400], [150, 250, 100]).set_duration(1).set_fps(5)+ clip = rotate(clip, 20)+ clip.write_videofile(os.path.join(TMP_DIR, "color_rotate.webm"))+close_all_clips(locals())