On Mon, 30 Jan 2012, Mark M wrote:
> I want to have the mouse on a web browser allow a user to free hand draw
> using different colors and pen thicknesses over an existing image and place
> text (through a text insert cursor) on the same image. The text could be of
> different fonts, colors and sizes also. I want a person to be able to
> annotate an image. I would like to use GraphicsMagick (under Linux) to
> overlay this text and drawing over the image using its ability to annotate.
> In looking over the FAQs and documentation, I think the way to do that is to
> use the -draw command and use point (or line) and text primitives to do the
> job. I could see where this could get into thousands of points potentially.
> Will that overload the command line or cause any noticeable slowdown in
> processing if I have thousands of primitives? Is there an XML way do to
> same thing where all the annotation information could be put in an XML file?
Yes, -draw is a way to to this. There is some support for SVG XML
format (.svg) as long as you take care to only use supported features.
The syntax used by -draw is known as "MVG" and may be put in a file
with the extension ".mvg". Since MVG is the native command set, it is
more efficient and reliable than SVG. MVG is not completely
documented. It is capable of far more than the GraphicsMagick
documentation suggest. The notes at this URL describe the syntax of
all the commands:
Thousands of commands are ok, but GraphicsMagick is not known to be
the fastest drawing/rendering tool so some time will be required and
there would be some load on the server.
> It appears I need to use -font to set the text font name, do I use
> -foreground or -fill to set the text and pen colors? Could I use the -file
> command to save out an overlay differential to prevent reprocessing every
> time I display.
Yes, the pen and text colors are fully controllable. I am not sure
about -file. I recommend that a scripting extension like PerlMagick,
TclMagick, RMagick, or PythonMagick be used to deal with complex
algorithms and caching.
> My intentions are not to modify the original image, but to process the
> annotations in real time, that way they could be toggled on or off without
> having to store both versions of the file.
There is a special file format called "MPC" (for "Magick Persistent
Cache") which can be used to make file-reloading virtually free.
However, this "format" actually writes a .mpc file and a .cache file
(two files) so it is not a normal file format.
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/