Skip to content

Instantly share code, notes, and snippets.

@Koenvh1
Created March 3, 2018 21:24
Show Gist options
  • Save Koenvh1/992f67d31a6e94d95a39a9a0d2573ccc to your computer and use it in GitHub Desktop.
Save Koenvh1/992f67d31a6e94d95a39a9a0d2573ccc to your computer and use it in GitHub Desktop.
Create an album image mosaic
from os import system, listdir, chdir
import random
for current_row in range(9):
images = []
for i in range(16):
images.append("artistart\\" + random.choice(listdir("artistart")))
print(images)
system("magick " + " ".join(images) + " +append artistart\\rows\\row" + str(current_row) + ".png")
rows = []
for key in listdir("artistart\\rows"):
rows.append("artistart\\rows\\" + key)
system("magick " + " ".join(rows) + " -append result.png")
system("magick result.png -resize 1920x1080 -quality 70 -depth 8 result.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment