promptmx

Automates batch image generation in Draw Things using structured prompts, variable substitution, and unified settings for fast, repeatable creative workflows.


Keywords
LPCS, Lab'Oratoire, automation, DrawThings, prompting, batch_generation, workflow, sonaliwan, french, english, cli
License
Other
Install
nimble install promptmx

Documentation

   _._
 o|- -|o This file is licensed under CC BY-NC-SA 4.0 international license.
  ( l )  To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
    =    Author: jean-marc "jihem" quere 2026

promptmx/drawit

Lab'Oratoire / Projet magenta - Laboratory of Cognitive and Social Psycholinguistics
https://lipunila.sonaliwan.fr - metalab(at)sonaliwan.fr

drawit is a client for the Draw Things image generator (https://drawthings.ai). It allows defining default settings (drawit.json) to apply to a set of images generated from the prompts contained in the specified file (e.g., drawit prompts.txt). Each line corresponds to a prompt template that may generate one or several images (depending on the value of batch_count).

A template line (of prompts) may be associated with specific settings, e.g. "sortOf|Sort of {0} on a {1} illuminated by daylight." The settings to apply are stored in the file: "sortOf.json".

The prompt property allows specifying a list of values to substitute into variables ({}). Example: "old broken phone|indian girl reading a book||couch in a sweet home|rock in the forest". {0} old broken phone | indian girl reading a book || {1} couch in a sweet home | rock in the forest

The images corresponding to the following prompts will be generated (in the Out folder):

  • Sort of old broken phone on a couch in a sweet home illuminated by daylight.
  • Sort of old broken phone on a rock in the forest illuminated by daylight.
  • Sort of indian girl reading a book on a couch in a sweet home illuminated by daylight.
  • Sort of indian girl reading a book on a rock in the forest illuminated by daylight.

The file names include:

  • the hash of the prompt (that produced the image),
  • the line number in the file (001 to …),
  • the hash of the submitted file name (e.g., for prompts.txt),
  • the start time in the format YYYYMMDDHHmmss,
  • the number within the batch (001 to batch_count).
  • The image is stored in .png format (and its parameters in .json format).

Example: CDDD3644-0002-08C7028C-260830181402-002.json { "url":"http://127.0.0.1:7860/sdapi/v1", "prompt":"Picture of a castaway, alone on the beach of a deserted island, scans the horizon in search of a sail. The art is done with an HB pencil, in a sketch style.", "negative_prompt":"", "guidance_scale":1.5, "batch_count":2, "width":384, "height":538, "steps":8, "seed":-1, "error":0 }

The meaning of error codes 0 to 3 is given below:

  • 0, "🟢": no error, image generated correctly.
  • 1, "🟡": unknown or missing parameter; image generated using the valid parameters provided and defaults for the others.
  • 2, "🟠": anomaly in the parameter description file (missing, invalid JSON, etc.); image generated using only default parameters.
  • 3, "🔴": error during generation; the image could not be produced.

Start Draw Things, enable the API server (HTTP on port 7860), then run nimble build followed by drawit.nim prompt.txt.