Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chrimble (2034)

chrimble
  (email not shown publicly)
http://chris.carline.org/

Journal of chrimble (2034)

Wednesday June 25, 2003
09:36 AM

Batik Rasterizing

[ #13057 ]

SVG is great fun. Gone are the days of faffing about in the Gimp trying to make consistant-looking buttons for my website - now it's simply a matter of knocking out a quick script that outputs some appropriate SVG ready for conversion into a bitmap format.

For that purpose, I use the batik rasteriser. Whilst it's java-based and no speed demon, it produces some nice output, and it's fairly easy to get good results. Unfortunately, it also requires a connection to an X server as it relies on the AWT for some of its functions - even the command line tools such as the rasterizer. Nothing appears on the screen - it just needs the X connection otherwise a fatal exception is raised.

So I've been down a merry "xhost + [machine]" route whilst setting the DISPLAY environment variable to point back my workstation from the development box (no X). This is officially Inconvenient, and I've been grumbling about it for a while. The previous official "solution" to this problem was to set up xvfb and use that. Again, Inconvenient.

Happily though, today I found a proper solution. Java 1.4 has introduced a "headless" mode which can be activated by adding a simple "-Djava.awt.headless=true" flag to the java call that runs the rasterizer. Yay!

So I thought I'd put it here in case I needed to remember it again. ;-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Unfortuantely, only MOST of the AWT methods work in this mode. For the few that still require connectivity to an X server, it will then throw a HeadlessException instead of just a general Exception, so you have some idea what the underlying failure was about. (i.e. "You used an AWT method that requires an X server.")