Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/der3318/colorful-img
Python Scripts - Generating Images of Different Color Styles
https://github.com/der3318/colorful-img
colors generator matplotlib
Last synced: 6 days ago
JSON representation
Python Scripts - Generating Images of Different Color Styles
- Host: GitHub
- URL: https://github.com/der3318/colorful-img
- Owner: der3318
- Created: 2022-08-06T09:49:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-05T13:54:16.000Z (about 2 years ago)
- Last Synced: 2023-02-28T21:01:17.424Z (over 1 year ago)
- Topics: colors, generator, matplotlib
- Language: Python
- Homepage:
- Size: 1.52 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 🎨 Render Colorful Image
![python](https://img.shields.io/badge/python-3+-blue.svg)
![matplotlib](https://img.shields.io/badge/matplotlib-3.6.1-green.svg)
![pillow](https://img.shields.io/badge/PIL-9.2.0-brightgreen.svg)
![cv2](https://img.shields.io/badge/opencv%20python-4.6.0.66-yellow.svg)A python script to render image into different color styles.
### 📝 How to Use
Setup the python environment via `python -m pip install -r requirements.txt` and simply invoke [generate.py](https://github.com/der3318/colorful-img/blob/main/generate.py) with the image file name or path. It will generate 13 colorful images under the same directory, with extension `.style[01-13].[jpg/png]`.
### 💡 How This Works
First, every pixel in the input image is converted into HSV descriptors from RGB values.
| |
| :- |
| (sample illustration from https://blog.csdn.net/Mark_md/article/details/115132435) |Then, add a "unified shift" to to the hue (H) channel of each cell. By doing so, the relative values in the image are still kept, but the overall color theme is transformed. Repeat the same process using differnet "shifts" (in the sample, it is 1/13, 2/13, ..., 12/13), to render diffenet kinds of color styles.