in reply to Diagram to JPEG

You might want to have a look at GraphViz to communicate with, well, GraphViz, a series of programs to produce nice renderings of graphs (if your diagram can be expressed as a graph).

To create/manipulate graphs in Perl, Graph comes to the resque and using Graph::Writer it can be saved to a file that can be used by GraphViz.

Note that I use the word "graph" in the mathematical sense of a set of vertices connected with edges, not in the sense of a plot.

Hope this helps, -gjb-