miriam_e: from my drawing MoonGirl (Default)
miriam_e ([personal profile] miriam_e) wrote2026-01-28 03:47 pm

ImageMagick for drawing

If anybody is interested here are the ImageMagick commands I used for my most recent l-systems experiments.

To create a blank, white canvas:
magick -size 512x512 xc:white canvas.pngmagick -size 512x512 xc:white canvas.png


To draw a black line:
magick canvas.png -stroke "$col" -strokewidth $w -draw "line $xp,$yp $xnp,$ynp" -quality 0 canvas.png


canvas.png is the input image to be written on.

-stroke sets the color of the line (I used the variable $col, which I set to "green")

-strokewidth sets the thickness of the line (in this case $w, set to 1)

-draw and the command "line" sets the start and endpoints of the line.

-quality was ChatGPT's excellent suggestion to force an uncompressed png image. It suggested a different, incorrect command, but the idea was spon-on.

canvas.png is specified again as the output image.