GraphStream Users

Archives de la liste Aide

Re: Export graph to image file

Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT>
  • To: graphstream-users AT
  • Subject: Re: Export graph to image file
  • Date: Tue, 5 Jul 2011 01:29:58 +0200

New changes are online here:) Tell me if you need a jar.
I am documenting this on the GraphStream website

In a few words, sink can be used in this way :

DefaultGraph g = new DefaultGraph("my beautiful graph");
FileSinkImages pic = new FileSinkImages(OutputType.PNG, Resolutions.VGA);

g.addEdge("AB", "A", "B");
g.addEdge("AC", "A", "C");
g.addEdge("BC", "B", "C");
pic.writeAll(g, "sample.png");

The LayoutPolicy has to be enabled if nodes of your graph do
not contain coordinates.

This is experimental so please tell me if you have troubles
with this new version.

Hope this helps ...


2011/7/5 Antoine Dutot <antoine.dutot AT>

Alternatively, you can store a "ui.screenshot" attribute on the graph whose value is the file name of the result. This attribute will be read by the viewer and it will output the screenshot and then automatically delete the attribute.

For example:

graph.addAttribute("ui.screenshot", "some/place/image.png");

This should work with version 1.0. We really need to document this !!



Le 4 juil. 2011 23:48, "guilhelm savin" <guilhelm.savin AT> a crit:

> Hi Javier,
> Thanks for the interest you have to GraphStream :)
> The problem of writing a simple image (so make a screenshot) has
> already be raised and I have done some modifications in FileSinkImages
> to do that but ... I do not have commited this changes !
> These changes allow to use FileSinkImage.writeAll(graph, "image.ext") to
> export a single image.
> I just make some verifications on the code and I will commit it.
> Regards.
> 2011/7/4 Javier Orellana <fjorella AT>
>> Hello,
>> First of all, I would like to congratulate the development team for this
>> version of GraphStream. It seems to be really powerful and according to the
>> example videos you have posted in the web I only can say: AWESOME
>> Well, I am testing the GraphStream library trying to perform some basic
>> actions before doing more complicated stuff. The thing is that I am missing
>> the GraphViewerRemote class used in previous versions to obtain a screenshot
>> of the graph.
>> In other thread I have been reading about a similar issue and the answer
>> was related to the tutorial in this page: http://graphstream-project.**
>> org/doc/Tutorials/Creating-a-**movie-with-FileSinkImages_1.0/<>

>> For what I understand, that tutorial explains how to generate a sequence of
>> images basing on the instructions stored in a DGS file.
>> I am wondering if it would be possible to build an only picture showing the
>> final graph, which is generated by means of the Graph class (just like it
>> was performed in the 0.4.2 version)
>> I have been reading the tutorial but It doesn't result too much clear about
>> this topic.
>> Thank you and congratulations again :)
>> Regards,
>> Javier Orellana
> --
> Guilhelm Savin
> PhD Student of Computer Science
> LITIS, University of Le Havre
> \/\/\/\/\/\/
> /\/\/\/\/\/\

Guilhelm Savin
PhD Student of Computer Science

Archives gérées par MHonArc 2.6.16.

Top of page