There is no must in art because art is free.
The following tutorial exaplains how to generate computer art based on a series of predefined digital images. Our script will combinate all the digital images generating an specific image collection
We will use the following digital assets:
4 x backgrounds images12 x bodies images12 x faces images
Our script will generate 576 new images as a result of combinate 4 x 12 x 12 (backgrounds, bodies, and faces).
The script was successfully tested with:
Python 3.8.5Pip 21.2.4Pillow 8.3.2
There is an images folder with 3 sub-folders
/images/backgrounds/images/bodies/images/faces
Inside each sub-folder there is a few transparent png files named with 2-left pad zero strategy, for example: 01.png, 02.png, ..., 11.png
# importing the Pillow modulefromPILimportImage, ImageDraw, ImageFilter# my primary source :DkBackgrounds=4kBodies=12kFaces=12forindex_backgroundinrange(1, kBackgrounds+1): forindex_bodyinrange(1, kBodies+1): forindex_faceinrange(1, kFaces+1):im1=Image.open(/path/to/index_background.png) im2=Image.open(/path/to/index_body.png) im3=Image.open(/path/to/index_face.png)The magic happens because all the bodies and all the faces have the same canvas/size!
# paste body into backgroundim1.paste(im2, (540, 1970), mask=im2) # paste face into backgroundim1.paste(im3, (456, 370), mask=im3)# save!im1.save(/path/to/new-image.png) # update status!print(/path/to/new-image.png, "was successfully created.")

