A Python script generating images with all the RGB colors in a set bit depth.
I wanted to generate an image containing every color, so here we go.
This not-so-handy tool is ready to make any image you want! Just simple these simple (I swear, it’s simple) instructions.
Skip to installation or script usage to start making images right away or scroll down a little bit to learn how this works and look at some finished images. Also check my Instagram profile to see more of my work!
This is how the script operates:
You can find a few more images inside the output folder or on my Instagram profile.
Started with a random pixel in center
Started with a random pixel in center
Started with 2 pixels in random positions
Started with 4 pixels in random positions
Started with 5 pixels in random positions
Started with 1 pixel in each corner
Started with a random pixel in center
Started with 1 pixel in each corner
Started with a random pixel in center
Started with 1 pixel in each corner
Composition of 64 small images
Composition of 4 images
Composition of 4 images
Minimum selection
Final image
Average selection
Final image
Sorted by hue
Final image
All the following steps require you to have Python installed. If you haven’t, download it here.
git https://github.com/lorossi/every-color
if you have git installed ) or download the release here.every-color.py
pip3 install -r requirements.txt
python3 every-color.py
. Check below for the available options or launch writing python3 every-color.py -h
Command | Description | Defaults | Type | |
---|---|---|---|---|
-h --help |
show help | none |
- | - |
-n --NUMBER |
number of images to generate | 1 |
int |
|
-b --BITS |
image depth bits | 15 |
int |
|
-p --STARTPOSITION |
location of the first pixel | center |
{center, corner, random} |
|
-c --STARTCOLOR |
color of the first pixel | random |
{white, black, random} |
|
-o --OUTPUT |
output folder | output |
str |
|
-l --LOG |
log destination | file |
{file, console} |
|
--PROGRESSPICS |
number of progress pics to be saved | 0 |
int |
|
--SORTCOLORS |
sort colors before placing them | random |
{"hue", "saturation", "brightness", "default", "reverse", "random"} |
|
--DISTSELECTION |
select how new colors are selected according to their distance | min |
{min, average} |
|
--STARTPOINTS |
number of starting points | 1 |
int |
|
--SEED |
seed for random function | epoch time |
str |
All arguments are optionals
python3 every-color-py
python3 every-color.py -b 18
python3 every-color.py -n 5 -l console
generated/
: python3 every-color.py -n 2 -p center -o generated
python3 every-color.py -c white --progresspics 200
python3 every-color.py --sortcolors hue
python3 every-color.py -n 5 --startpoints 5 --distselection average
If, for any reason, you need to pause the script, create a file called PAUSE
in the working folder. As long as the file is there, the script will be paused.
The script takes quite a while to generate big pictures (up to ~1.5 hours for 18 bits pictures with minimum selection, up to ~48 hours with average selection). There isn’t much room for optimizations and, according to my tests, parallelization won’t increase much the speed. The most computationally expensive process is searching for a better pixel.
Maybe Cython could help me with this task?
FFmpeg commands used:
ffmpeg -i frames/%03d.png -vf fps=25,scale=512:-1 out.mp4 -y
ffmpeg -i frames/%03d.png -vf fps=20,scale=512:-1 out.gif -y
I like PEP8 but 79 characters is definitely not enough.
This project is distributed under Attribution 4.0 International (CC BY 4.0) license.