Skip to main content

A simpler example...

1 reply [Last post]
Brett@Zamora.com
Offline
Joined: 2006-02-17

Hi...

Okay... you can ignore my previous post... I wanted to eliminate my code as the possible culprit, so I've put this VERY simple code together. When I read the sample1.tif file, I get the the Exception message that I've included.

I have no problem display sample1.tif in the Windows Picture and Fax viewer.

This is a serious issue for me, because the application that I wrote, is being used for a real-world one-time conversion task.

Can anybody give me any feedback on this? Should I just move on and find another api library?

Thanks,

Brett

Here is the a simple program that creates the Exception:

package com.exigentinc;

import java.io.File;
import java.util.Iterator;

import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;

public class ImageIOTest {

public static void main(String[] args)
{
String strFileName = "/TiffImages/sample1.tif" ;
String strFormat = "tif" ;

try
{
Iterator rs = ImageIO.getImageReadersByFormatName(strFormat);
ImageReader ir = (ImageReader) rs.next();
File srcFile = new File(strFileName);
ImageInputStream iis = ImageIO.createImageInputStream(srcFile);
ir.setInput(iis);
int nImageCount = ir.getNumImages(true) ;
IIOImage image = new IIOImage(ir.read(0), null, ir.getImageMetadata(0));
}
catch (Exception e)
{
e.printStackTrace() ;
}
}
}

Here is the Exception output:

java.lang.Error: Error 5
at com.sun.media.imageioimpl.plugins.tiff.TIFFFaxDecompressor.decodeT6(TIFFFaxDecompressor.java:1129)
at com.sun.media.imageioimpl.plugins.tiff.TIFFFaxDecompressor.decodeRaw(TIFFFaxDecompressor.java:651)
at com.sun.media.imageioimpl.plugins.tiff.TIFFCodecLibFaxDecompressor.decodeRaw(TIFFCodecLibFaxDecompressor.java:112)
at com.sun.media.imageio.plugins.tiff.TIFFDecompressor.decode(TIFFDecompressor.java:2488)
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.decodeTile(TIFFImageReader.java:963)
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1240)
at javax.imageio.ImageReader.read(ImageReader.java:919)
at com.exigentinc.ImageIOTest.main(ImageIOTest.java:26)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23