Overview
Python script for exporting large batches of random images from Krita by turning trait layers on and off. It handles weighted traits, rarity, unique combinations, JSON metadata and optional animated GIFs.
It's basically the scaffolding from a script I used in 2021 to generate a bunch of random images and gifs, so it's meant as a starting point to modify, not something to run as is.
Setup
Edit the attributes and rarity_counts at the top of randomMassExporter.py, then run it through Krita's built-in Scripter plugin with the source document open. Trait layers need names like traitName_variationName, and they can be inside groups.
Animation export
Set up the animation timeline in Krita, leave generate_animation on, and set ffmpeg_path if FFmpeg isn't on your PATH.