Saving to a .png file


Is there any way to save to a .png file, or is SVG the only way to go???


I haven’t tried it, but if you are using JDK/JRE 1.4, you can use the Image I/O classes.


okay, i’ve got the SVG graphic already, now are you saying that you can convert the SVG to png or is there a way for the ImageIO class to get the JGoDocument and render an image from it.


Oh, no, I was assuming you didn’t want to have a dependency on SVG if you could avoid it. I thought you were asking about a direct JGoView or JGoDocument to PNG image file conversion.
If you look at the examples/imager/ class, you’ll see an example of this. Now this particular example uses Sun’s JPEG codec, but I believe you can substitute that code with ImageIO writer calls.


OK, so i got the image saving to a .png file. However the top-left corner of the diagram is getting cut off. I can’t figure out what is causing this to happen. I’ve tried resetting the coordinates of both the view and the document but nothing works. What am I doing wrong…

The troubled newbie