Key Features • How to Use • Try it Out! • Acknowledgements • License
- Recreate any image through genetic algorithms: Genetic Artist uses genetic algorithms to recreate images by painting brushstrokes, resulting in unique and stunning artwork.
- Customize the stroke library for any art style: You can provide a folder of stroke images for the program to use. Experiment with known art styles or create your own unique mixes.
- Don't start on a blank canvas: The starting canvas image can be customized to help the artist recreate the image faster or experiment with the output.
- Watch the creative process in action: A window opens by default, allowing you to watch the artist at work and see the progress brushstroke by brushstroke.
- Free and open-source!: Every part of the Genetic Artist is accessible for you to experiment and tinker with. Don't be shy and contribute all you want!
- Run on any platform: Genetic Artist is cross-platform and easy to run on any machine, whether it be Windows, macOS or Linux.
To run this program you will need Python 3 with pip installed.
- Clone this repository or download it instead:
git clone https://github.com/Tikitikitikidesuka/GeneticArtist.git
- Go into the repository directory:
cd GeneticArtist
- Install the project's dependencies:
pip install -r requirements.txt
- Run the artist:
python src/main.py --target <Target Image> \
--strokes <Stroke Directory> \
--config <Config File> \
--iterations <Number of Strokes To Draw> \
--output <Ouptut Image>
To get a detailed output of what the program is doing add --verbose
to the parameters.
To hide the preview window add --nogui
to the parameters.
In case you do want it, remember to press ESC to close it when the program is done.
Note
The GUI is still a prototype and will be changed shortly
Ready to see the magic happen? Check out some examples of what you can create with Genetic Artist.
Example strokes, target images, and canvases are provided in the repository, so you can try out the program right away. Here are a few examples to get you started:
To create a painting of the night sky, navigate to the project folder and run the following command:
python src/main.py --target examples/targets/moon.jpg \
--strokes examples/strokes/ \
--canvas examples/canvases/white.jpg \
--config examples/configs/medium_quality.toml \
--iterations 256 \
--output outputs/my_moon256.png \
--verbose
This will produce a beautiful painting like the one shown below:
If you prefer a peaceful lake landscape, run this command instead:
python src/main.py --target examples/targets/lake.jpg \
--strokes examples/strokes/ \
--canvas examples/canvases/black.jpg \
--config examples/configs/high_quality.toml \
--iterations 256 \
--output outputs/my_lake256.png \
--verbose
The result will look something like this:
Feel free to experiment with different target images, strokes, and canvases to see what unique creations you can come up with!
This project wouldn't be possible without the following open source packages:
- PyGAD to power the image recreation process in our program.
- OpenCV and Numpy to handle the image processing and manipulation tasks.
- Numba to accelerate the custom image processing functions.
The example images are provided by Pixabay:
- lake.jpg image by Joe from Pixabay
- moon.jpg image by kien virak from Pixabay
Genetic Artist is distributed under the MIT License. See LICENSE.md
for more information.