Pillow library is used.
Firstly, we split a picture into sme parts.
The rgb value of each part is calculated through the average rgb algorithm, then we compare it with the rgb value of the pictures in the stock.
Pick the picture with the smallest difference and fill it in the part.
Finally, a mosaic picture is obtained, which is one picture from a distance but a collection of many other pictures when enlarged.
The file MosaicMaker.py is code.
The MMs phtots are the original pictures and the BBs photos are the pictures after processed.