• 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

how to add tiff writer to imageio package?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic