Skip to content
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

Rename 'colorx' FX by 'multiply_color' #1475

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion docs/getting_started/effects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Much better! There are already many effects implemented in the modules ``moviepy
clip = (VideoFileClip("myvideo.avi")
.fx( vfx.resize, width=460) # resize (keep aspect ratio)
.fx( vfx.speedx, 2) # double the speed
.fx( vfx.colorx, 0.5)) # darken the picture
.fx( vfx.multiply_color, 0.5)) # darken the picture

For convenience, fx methods such as ``resize`` can be called in a simpler way: ``clip.resize(...)`` instead of ``clip.fx( vfx.resize, ...)``

Expand Down
4 changes: 2 additions & 2 deletions docs/ref/videofx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ When you type: ::

from moviepy import *

the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``vfx.resize`` etc.
the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.multiply_color``, ``vfx.resize`` etc.


.. currentmodule:: moviepy.video.fx.all
Expand All @@ -36,7 +36,6 @@ the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``v
accel_decel
blackwhite
blink
colorx
crop
even_size
fadein
Expand All @@ -55,6 +54,7 @@ the module ``video.fx`` is loaded as ``vfx`` and you can use ``vfx.colorx``, ``v
mask_or
mirror_x
mirror_y
multiply_color
painting
resize
rotate
Expand Down
6 changes: 3 additions & 3 deletions docs/ref/videofx/moviepy.video.fx.all.colorx.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
moviepy.video.fx.all.colorx
===========================
moviepy.video.fx.all.multiply_color
===================================

.. currentmodule:: moviepy.video.fx.all

.. autofunction:: colorx
.. autofunction:: multiply_color
4 changes: 2 additions & 2 deletions moviepy/video/fx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from moviepy.video.fx.accel_decel import accel_decel
from moviepy.video.fx.blackwhite import blackwhite
from moviepy.video.fx.blink import blink
from moviepy.video.fx.colorx import colorx
from moviepy.video.fx.crop import crop
from moviepy.video.fx.even_size import even_size
from moviepy.video.fx.fadein import fadein
Expand All @@ -22,6 +21,7 @@
from moviepy.video.fx.mask_or import mask_or
from moviepy.video.fx.mirror_x import mirror_x
from moviepy.video.fx.mirror_y import mirror_y
from moviepy.video.fx.multiply_color import multiply_color
from moviepy.video.fx.painting import painting
from moviepy.video.fx.resize import resize
from moviepy.video.fx.rotate import rotate
Expand All @@ -36,7 +36,6 @@
"accel_decel",
"blackwhite",
"blink",
"colorx",
"crop",
"even_size",
"fadein",
Expand All @@ -55,6 +54,7 @@
"mask_or",
"mirror_x",
"mirror_y",
"multiply_color",
"painting",
"resize",
"rotate",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np


def colorx(clip, factor):
def multiply_color(clip, factor):
"""
Multiplies the clip's colors by the given factor, can be used
to decrease or increase the clip's brightness (is that the
Expand Down
6 changes: 3 additions & 3 deletions tests/test_fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from moviepy.utils import close_all_clips
from moviepy.video.fx import (
blackwhite,
colorx,
multiply_color,
crop,
even_size,
fadein,
Expand Down Expand Up @@ -120,11 +120,11 @@ def test_blackwhite():
# clip1.write_videofile(os.path.join(TMP_DIR,"blink1.webm"))


def test_colorx():
def test_multiply_color():
color_dict = {"H": (0, 0, 200), "L": (0, 0, 50), "B": (0, 0, 255), "O": (0, 0, 0)}
clip = BitmapClip([["LLO", "BLO"]], color_dict=color_dict, fps=1)

clipfx = colorx(clip, 4)
clipfx = multiply_color(clip, 4)
target = BitmapClip([["HHO", "BHO"]], color_dict=color_dict, fps=1)
assert target == clipfx

Expand Down