Win a copy of Spring Boot in Practice this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

ImageIO.write returns false

 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bb turns out to be false in the following code, but a blank image is still created. That behavior confused me enough, but what is getting me now is how to use ImageIO.write to write a tif file to the file system?




I used the code I found here to list available image formats and of course tif is not listed:

jpeg
bmp
wbmp
gif
png
jpg
jpeg
bmp
wbmp
png
jpg
image/png
image/jpeg
image/x-png
image/vnd.wap.wbmp
image/bmp
image/gif
image/png
image/jpeg
image/x-png
image/vnd.wap.wbmp
image/bmp


documentation says ImageIO.write() "Writes an image using an arbitrary ImageWriter that supports the given format to a File."

I don't understand "arbitrary" here. Is there any way to force it to use a specific ImageWriter? or another way to write tif files?

In asking this question, I solved it. By comparing my environment with a previous environment that worked, I found that adding jai_imageio to my classpath fixed the issue. tif is now included in my available image formats. Without jai_imageio.jar, the code still compiles and runs, but it obviously uses a different ImageWriter. jai_imageio has a plugin directory with a class called TIFFImageWriter. I am still confused by how this is set up.
 
reply
    Bookmark Topic Watch Topic
  • New Topic