• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to add tiff writer to imageio package?  RSS feed

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
His

I am trying to convert a png image to tiff format (to ocr the text with http://code.google.com/p/tesseract-ocr/ than). searched the web and found the imageio package.
However, as shown at
http://www.java2s.com/Code/Java/2D-Graphics-GUI/ListAllreaderandwriterformatssupportedbyImageIO.htm
i tried running the code



to find out if tiff writer is available, and turns out to be not.

Using jdk 1.5, could anyone suggest how to add a writer and where to find a good one?

Thanks
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need the JAI ImageIO package: http://java.net/projects/jai-imageio/ (Note that this is different from JAI itself, which is not needed.)

In theory, ImageIO should pick up TIFF support automatically if you have it in the classpath, but I haven't gotten that to work. So you may need to register it in code:

That's all there is to it. The library also contains a GIF writer (which JDKs < 1.6 don't have), as well as RAW, PNM and JPEG2000 readers and writer, just in case you ever need those.
 
Denis Wen
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, it did help. Actually, the plugin was picked up automatically, so i did not need to make any extra api calls.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!