Take an image like this:
And transform it to this:
- Install the package:
pip install pyrainboweffect
In a Python console, import the package:
>>> import pyrainboweffect
Apply the effect to an image file and save the result as a gif:
>>> pyrainboweffect.psychedelic_gif('input.png', 'output.gif')
Apply the effect to an image file and save the result as an mp4:
>>> pyrainboweffect.psychedelic_mp4('input.png', 'output.gif')
To use the CLI:
$ python -m pyrainboweffect input.png output.gif
For the complete API documentation, click here.
This effect can be generated as follows:
- Convert the image to greyscale.
- Partition the intensity space into the same number of partitions as colors in the color scheme.
- Set the intensity regions to their corresponding colors
- Increase the intensity of all pixels in the original image (restarting at 0 intensity if overflow occurs).
- Go to step 2 and repeat until there are enough sequential frames to make an animation.
Only Python version 3.6 and greater are supported. This package should run on any POSIX system as well as Windows 7 and greater.
The following Pypi packages are required:
- moviepy
- numpy
- opencv-python
Suggestions and pull requests are welcome. If you find a bug and don't have time to fix it yourself, feel free to open an issue.
- TODO: Apply the psychedelic effect to an animated image or video.