# Which Image Generation Library?

**URL:** <https://www.ruby-forum.com/t/which-image-generation-library/116389>\
**Category:** Ruby\
**Created:** [October 5, 2007, 3:51am UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389 "2007-10-05T03:51:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![winter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/2bfe46/32.png) [@winter](https://www.ruby-forum.com/u/winter)\
**Post date:** [October 5, 2007, 3:51am UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389/1 "2007-10-05T03:51:35Z")

</div>

I need to create a small program that generates images and “animations”  
(i can cheat on the animation) of Petri nets. Something like the  
wikipedia page’s ([Petri net - Wikipedia](http://en.wikipedia.org/wiki/Petri_net)) examples, but  
automatically generated based on simple input.

I’m thinking about doing this in Ruby (with Gnome 2) but don’t know what  
image generation/manipulation tool would be best to use or if i should  
go with something else. Does someone have a suggestion? Ideally  
something with some good documentation. It doesn’t have to be  
sophisticated, just enough to algorithmically generate pictures. I’m  
planning on using Gnome 2 as well, if this makes a difference.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![winter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/2bfe46/32.png) [@winter](https://www.ruby-forum.com/u/winter)\
**Post date:** [October 5, 2007, 5:43am UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389/2 "2007-10-05T05:43:35Z")

</div>

On 5 Oct 2007, at 10:51, Winter Ayars wrote:

> go with something else. Does someone have a suggestion? Ideally  
> something with some good documentation. It doesn’t have to be  
> sophisticated, just enough to algorithmically generate pictures. I’m  
> planning on using Gnome 2 as well, if this makes a difference.

Cairo can make nice figures and there are Ruby bindings. The bindings  
have little (no?) documentation, but Cairo itself is very well  
documented and there are good docs for the Python bindings which are  
almost identical.

I’d post links, but Google is your friend really.

Alex G.

Bioinformatics Center  
Kyoto University

---

<div class="post-metadata">

**Author:** ![winter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/2bfe46/32.png) [@winter](https://www.ruby-forum.com/u/winter)\
**Post date:** [October 5, 2007, 5:49am UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389/3 "2007-10-05T05:49:26Z")

</div>

Alex G. wrote:

> > something with some good documentation. It doesn’t have to be  
> > Alex G.
> 
> Bioinformatics Center  
> Kyoto University

I’ve seen quite a few Petri net animations on the web – perhaps you  
could grab one of those and just do the Ruby scripting.

---

<div class="post-metadata">

**Author:** ![winter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/2bfe46/32.png) [@winter](https://www.ruby-forum.com/u/winter)\
**Post date:** [October 5, 2007, 8:39am UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389/4 "2007-10-05T08:39:26Z")

</div>

John J. wrote:

> In the end though, Javascript might be a lot easier…

I was thinking about Javascript, although i sort of wanted to stay away  
from that. Maybe i should reconsider…

Anyway, thanks for the advice everyone. I’ll look into these things.

---

<div class="post-metadata">

**Author:** ![winter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/2bfe46/32.png) [@winter](https://www.ruby-forum.com/u/winter)\
**Post date:** [October 5, 2007, 6:10am UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389/5 "2007-10-05T06:10:28Z")

</div>

On Oct 4, 2007, at 10:47 PM, M. Edward (Ed) Borasky wrote:

> > > know what  
> > > I’d post links, but Google is your friend really.  
> > > Alex G.  
> > > Bioinformatics Center  
> > > Kyoto University  
> > > I’ve seen quite a few Petri net animations on the web – perhaps  
> > > you could grab one of those and just do the Ruby scripting.

You could do it with RMagick, it is the Ruby lib for ImageMagick. It  
can handle vector art and raster art. It has quite good documentation  
too. Not sure about animation or interactivity, but you could do that  
using one of the game oriented libs like Gosu or Ruby/SDL or RubyGame.

In the end though, Javascript might be a lot easier to just program  
an animation, you could then simply use any HTML view for display  
(web browser). That said, you might look into Scriptaculous or  
Prototype, the Ruby bound Javascript libraries that are commonly used  
in Ruby on Rails for eyecandy.

---

<div class="post-metadata">

**Author:** ![winter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/2bfe46/32.png) [@winter](https://www.ruby-forum.com/u/winter)\
**Post date:** [October 5, 2007, 3:36pm UTC](https://www.ruby-forum.com/t/which-image-generation-library/116389/6 "2007-10-05T15:36:41Z")

</div>

Winter Ayars wrote:

> planning on using Gnome 2 as well, if this makes a difference.
> 
> Thanks in advance!

Look at Graphviz. It may do exactly what you want, at least if you  
aren’t too picky about layout and graphic conventions.

> **[Graphviz](https://en.wikipedia.org/wiki/Graphviz)**
>
> Graphviz (short for Graph Visualization Software) is a package of open-source tools initiated by AT&T Labs Research for drawing graphs (as in nodes and edges, not as in barcharts) specified in DOT language scripts having the file name extension "gv". It also provides libraries for software applications to use the tools. Graphviz is free software licensed under the Eclipse Public License.
> Notable applications of Graphviz include:

> **[Graphviz](https://graphviz.org/)**
>
> Graph Visualization Software
