I want to use the imagemagick convert
command to draw on a image file. I have the image data as raw-text in a buffer and now I would like to run convert - -draw 'rectangle 0,0,100,100' -
on it (the dashes tell convert to use stdin for input and print the data to stdout). If I leave out the -draw 'rectangle 0,0,100,100'
then I can just use (call-process-region (point-min) (point-max) "convert" t t nil "-" "-")
to pass the buffer contents as stdin to the convert program and insert the from convert
returned image data in the buffer (this does not do anything but it works, e.g. I could replace the last -
with a filename to write the resulting image data to a file). However now I want to add the -draw 'rectangle 0,0,100,100'
as an extra argument to call-process-region
but I really can not find (out) how to do this properly. For example I tried (call-process-region (point-min) (point-max) "convert" t t nil "-" "-draw" "'rectangle 0,0,50,50'" "-")
but then I get message convert: non-conforming drawing primitive definition
rectangle 0,0,50,50' @ error/draw.c/RenderMVGContent/4473.`
I tried to run it as a shell-command (i.e. using /bin/bash -c
)? But then I don't know how to pass the buffer contents as input.
So I would like to know how to properly pass the single-quotes string 'rectangle 0,0,100,100'
to the command.
(FYI I would like to extend djvu.el to show annotations)