0

I am able to compress an image file using the jbig2.exe encoder.
I can easily execute the jbig2.exe from the command line ex: >jbig2.exe C:\images\image.jpg.
However I am trying to write a Java code that will invoke the jbig2.exe using a ProcessBuilder.
Now the image I have is a RenderedImage and I am getting confused over how to give it as input to the ProcessBuilder. Ex :

void encoder_to_jbig2(RenderedImage image) throws Exception{ 

ProcessBuilder pb = new ProcessBuilder();
pb.command("jbig2.exe");
Process p = pb.start();
OutputStream os = p.getOutputStream();

Thanks.

leppie
  • 115,091
  • 17
  • 196
  • 297
vpointer
  • 71
  • 7
  • convert RenderedImage to byte array and write the byte arrays to OutputStream to create the image file. Then use that path in the ProcessBuilder command method. – Sridhar Jan 08 '15 at 08:48
  • What input does the `jbig2.exe` command take? Can it read bytes from the console, or does it need a file input? Does it support "raw" pixels, or do you need some file format? – Harald K Jan 08 '15 at 12:23

0 Answers0