atom feed13 messages in net.java.dev.jai-imageio.interestRe: [JAI-IMAGEIO] Strange problem wit...
FromSent OnAttachments
Fabrizio GiudiciJun 14, 2007 4:48 am 
mja...@union06.deJun 14, 2007 5:08 am 
Fabrizio GiudiciJun 14, 2007 5:20 am 
robert engelsJun 14, 2007 6:41 am 
Fabrizio GiudiciJun 14, 2007 1:55 pm 
robert engelsJun 14, 2007 2:25 pm 
Fabrizio GiudiciJun 14, 2007 4:07 pm 
jai-...@javadesktop.orgJun 14, 2007 6:14 pm 
robert engelsJun 14, 2007 6:26 pm 
Brian BurkhalterJun 14, 2007 6:28 pm 
robert engelsJun 14, 2007 6:30 pm 
Brian BurkhalterJun 14, 2007 6:31 pm 
mja...@union06.deJun 15, 2007 12:09 am 
Subject:Re: [JAI-IMAGEIO] Strange problem with TIFF reading on Mac OS X
From:robert engels (reng@ix.netcom.com)
Date:Jun 14, 2007 2:25:20 pm
List:net.java.dev.jai-imageio.interest

Actually, the code looks specifically for the ImageIO tools reader - skipping the Mac OSX JVM one. (the formatting got changed when pasting)

On Jun 14, 2007, at 3:56 PM, Fabrizio Giudici wrote:

On Jun 14, 2007, at 15:42 , robert engels wrote:

The Mac JVM contains a TIFF ImageIO plugin as well. I have found it to be not as good as the one included in ImageIO tools, and can't read certain TIFFs.

I remembered an old email such as this. But I don't understand the example: aren't you excluding the JAI-ImageIO TIFF plugin? Which plugin do you use to read TIFFs?

I look for it and ignore it using code similar to the following:

/** * get an ImageReader for an ImageInpuStream. We have a preference for providers since consistent image processing is * a requirement. * * @param iis the non-null stream * @return the ImageReader * @throws ImageIOException if a suitable ImageReader cannot be found */ private static ImageReader getImageReader(ImageInputStream iis) throws ImageIOException { Iterator iter = ImageIO.getImageReaders(iis);

ImageReader reader = null; while(iter.hasNext()) { reader = (ImageReader) iter.next(); String classname = reader.getClass().getName();

// always use the imageio tools TIFF reader if(classname.indexOf("TIFF")>=0 && !classname.equals ("com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader")) { if(logger.isDebugOn()) logger.debug("skpping reader "+classname); continue; } break; } if (reader==null) { throw new ImageIOException("no reader available"); } return reader; }

On Jun 14, 2007, at 6:48 AM, Fabrizio Giudici wrote:

Hello.

I use the following code to find out the ImageReader to deal with a certain file:

private static ImageReader createImageReader (final ImageInputStream imageInputStream, final String suffix) throws IOException { try { for (Iterator<ImageReader> iterator = ImageIO.getImageReadersBySuffix(suffix); iterator.hasNext();) { ImageReader reader = iterator.next(); String pluginClassName = reader.getOriginatingProvider().getPluginClassName();

logger.finer(">>>> testing reader: " + reader + ", pluginClassName: " + pluginClassName);

if ((reader != null) && !unwantedPlugins.contains (pluginClassName) && reader.getOriginatingProvider ().canDecodeInput(imageInputStream)) { reader.setInput(imageInputStream); logger.finer(">>>> returning reader: " + reader + ", pluginClassName: " + pluginClassName); return reader; } }

throw new IOException("No ImageReader for the suffix: " + suffix); }

Of course JAI-IMAGEIO is in the classpath. In facts in the log I see:

13:24:02.810 [AWT-EventQueue-1 ] FINE ReadOp - getImageReader(/Users/fritz/Business/ Tidalwave/Projects/blueMarine/Test/Pleiades Small Set/w1.tif) 13:24:02.810 [AWT-EventQueue-1 ] FINER ReadOp - >>>> suffix is tif 13:24:02.812 [AWT-EventQueue-1 ] FINER ReadOp - >>>> testing reader: com.sun.imageio.plugins.tiff.TIFFImageReader@5b8c7f, pluginClassName: com.sun.imageio.plugins.tiff.TIFFImageReader

Nevertheless, the "canDecodeInput()" returns false and the method fail. This happens only on Mac OS X; the same application works fine with Linux and Windows. What's the problem?

PS Maybe I've read in the past months about a possible problem with TIFFs and Mac OS X but I can't recall.