You can create intermediate files using the mpr
pseudo format like this:
convert \( -size 150x150 xc:none -draw "path 'M50,50 h50 v50 -h-50 z'" \
-write mpr:clip \) +delete \
-size 150x150 xc: -fill 'blue' -clip-mask mpr:clip \
-draw "path 'h150,0 l-75,75 z" image.png
This uses -write
to cause the clip image to be written immediately (otherwise it is stacked until the end of the command sequence). It's then removed from the stack with +delete
(otherwise it'll also be written at the end of the command sequence). The -clip-mask
then reads the pseudo-file.
The pseudo file mpr
is Magick Persistent Registry and is documented here.