Create a collage of an image using smaller images
Full resolution output (4000x4000px)
- Install the
pip
package manager for Python 3.
sudo apt-get install python3-pip
- Install dependencies from
requirements.txt
.
python3 -m pip install -r requirements.txt
- Add JPG images to use as samples to the
samples/
folder. 9999 free sample images.
Sample sets containing images with a mix of different colors and light intensity will in general produce better results.
- Run
create.py
from~/collage
with Python 3.
python3 create.py
- Provide an input and output file path when prompted.
You can also pass the input and output file paths as arguments when running create.py
.
python3 create.py [path_to_input] [path_to_output]
9999 free 612x612px sample images (~1GB when inflated).
Note that 9999 images are probably overkill if the samples are random enough (which these are). 2000-4000 samples should be enough for most use cases.
Set | Size | Download |
---|---|---|
1-2000 | 193.5 MB | Download |
2001-4000 | 192.2 MB | Download |
4001-6000 | 191.2 MB | Download |
6001-8000 | 380.5 MB | Download |
8001-10000 | 191.4 MB | Download |
Resizing the output doesn't require any modification to the underlying code. It does however require that you instance each class manually.
- Import the required modules.
from classes.Samples import Samples
from classes.Collage import Collage
- Loading the samples with
Sample
. Nothing exciting here.
samples = Samples("samples",False)
- Initialize
Collage
and define your ownself.size
tuple.
collage = Collage("path/to/input.jpg",samples)
collage.size = (100,50) # (width,height) of each sample in the collage.
collage.put("path/to/write/output.jpg")
This repo is licensed under the MIT License
Report bugs and suggest features by creating an Issue.
Pull Requests to this repo are very appreciated.