posted 15 years ago
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.