• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 4499
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic