Paint linearts over commandline

I wish to paint drawings automatically from the commandline similar to:

convert draw.png -fill white -opaque blue draw.png

but using linearts with gmic

That’s not clear (I don’t know what the ImageMagick command does).
What is your input, a black on transparent lineart ? or something solid ?
What is your expected output ? Black on white ? Something else ?

For the case you have a Black on Transparent lineart and you want it white and black, then maybe :

$ gmic lineart.png 100%,100%,1,3,255 -rv -blend alpha -o result.png

I wish to paint of colours a white drawing and black, but has some holes:

sorry…

convert draw.png -fill blur -draw "color 1,1 floodfill" draw.png

this command is correct :blush:

I wish to do something like this, but for drawings made manually using gmic…

more info: Fred's ImageMagick Scripts: SEPARATE

This program would allow to paint drawings in series for animation

I have attained this, but is slow:

#!/bin/bash
#

LIMITE=5
PUNTOS=$(convert \
  $1 \
  -threshold  95%  \
  -fill White -opaque Red \
  +write linesBroken.png \
  -negate \
  -morphology Thinning:-1 Skeleton +channel \
  -morphology HMT LineEnds \
  txt:- | grep FFFFFF | cut -d: -f1)

PARCHE=$(for A in $PUNTOS; do
    for B in $(echo "$PUNTOS" | grep $A -A 1000); do
        [ "$A" == "$B" ] && continue

        X1=$(echo $A | cut -d, -f1)
        X2=$(echo $B | cut -d, -f1)
        Y1=$(echo $A | cut -d, -f2)
        Y2=$(echo $B | cut -d, -f2)
        XX=$(echo $((X1-X2)) | sed 's/-//')
        YY=$(echo $((Y1-Y2)) | sed 's/-//')
        [ "$XX" -lt "$LIMITE" ] && [ "$YY" -lt "$LIMITE" ]&& echo " -draw \"line $A $B\" "
    done
done)

echo convert $1 -stroke red -strokewidth 0 $PARCHE $1.linea.png | bash

Afterwards I separate the colours…

./myscript draw.png
convert  draw.png.linea.png -threshold 99%  draw.png.linea.png
./separate -m 3 draw.png.linea.png color.png