0

I would like to execute a program in the Xvfb virtual frame buffer and then take a look at it within runtime. From wikipedia I know it is possible to get a screenshot-file like this:

Xvfb :1 &
xv -display :1 &
xwd -display :1 -root -out image.xwd

Is it possible to read and decode the xwd output directly with Java using ProcessBuilder or Runtime.exec() ?

Kind Regards, Theo

Theo H.
  • 141
  • 1
  • 3
  • 8

1 Answers1

0

Not sure what the question really is: if you leave out the -out option, xwd will output to stdout and then indeed you can read this directly from the process within Java. Afaik the xwd-format is not something very common today, so if the question is whether Java can decode and use it, I think the answer is 'no' and you need to run yet another command to convert it. For easier use in Java, you might want to take a look at import from imagemagick, as it is able to write more easily handled formats, like png or jpeg.

Harald
  • 4,575
  • 5
  • 33
  • 72