• Post Reply Bookmark Topic Watch Topic
  • New Topic

converting raw fax file (G3 fax) into tiff using java

 
Manfred Ehgartner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a raw fax file (G3/T.4 format) and would need to convert it into some viewable TIFF/multipage tiff. I was playing around already using the jai library, but without success. I used tools from http://www.sfaxtools.com/ to successful convert my raw fax files into tiff (Batch Fax2Tif or Faxsee), but I need to do this programatically out of java. I couldn't find any concrete hint or snipplet so far. I attached two raw example G3 faxfiles (can be vonverted with the faxtools mentioned above). Thanks
1.jpg
[Thumbnail for 1.jpg]
example.jpg
[Thumbnail for example.jpg]
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If those tools have a command line option to perform the conversion, you can use ProcessBuilder. Make sure to read When Runtime.exec() won't first though.
 
Manfred Ehgartner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies, the possibility using exec to some external command or tool came already into my mind, but there is a performance overhead as it always creates a new OS process and it is also not OS independent.
I also considered a jni wrapper if I can find some C/C++ library, but again some drawbacks compared to a pure java solution.
I am really wondering that there is no java library or support in jai for such an old standard
 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the Java Advanced Imaging API with the TIFF codec (com.sun.media.jai.codecimpl.TIFFFaxDecoder?) can do this.
 
Manfred Ehgartner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron McLeod wrote:It looks like the Java Advanced Imaging API with the TIFF codec (com.sun.media.jai.codecimpl.TIFFFaxDecoder?) can do this.

I don't think, that this will work. TIFFFaxDecoder is a protected class of the jai package and is used internally, I could of course take the sources and try to play around, but I think there should be some ImageDecoder for this purpose.
What I am searching for is the following, check the code fragment below:


The problem is, thet the reading section especially
ImageDecoder decoder = ImageCodec.createImageDecoder("tiff", stream, decodeParams);
should be replaced by some ImageDecoder implementation which internally uses a FaxDecoder for decoding a g3 raw fas file. This decoded image I can afterwards simply write as tiff with the given code above. But I couldn't find a code snipplet so far which decodes the g3 rawfile.
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!