Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

how to add tiff writer to imageio package?

 
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: 43011
76
  • 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.
 
Hang a left on main. Then read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!