I am trying to use Image I/O to load some PNG images in an applet. The first time the applet calls the method that loads images, it works fine. But every time this method is called after that, I get strange IIOExceptions thrown. I am using the JRE 1.4 release candidate VM.
Here is an example of the exceptions I get- javax.imageio.IIOException: Unknown row filter type (= 255)! at com.sun.imageio.plugins.png.PNGImageReader.decodePass(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.readImage(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at com.pfpc.checkimage.applet.CheckImageApplet$1.run(CheckImageApplet.java:94) at java.lang.Thread.run(Unknown Source) javax.imageio.IIOException: Unknown row filter type (= 221)! at com.sun.imageio.plugins.png.PNGImageReader.decodePass(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.readImage(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at com.pfpc.checkimage.applet.CheckImageApplet$1.run(CheckImageApplet.java:104) at java.lang.Thread.run(Unknown Source) Here is the applet method that attempts to load the images (it is called from Javascript in my Web page ) public void manipulateImages( String fbwImageName, String bbwImageName, String bgsImageName ) { final JApplet thisApplet = this; final String fbwImage = fbwImageName; final String bbwImage = bbwImageName; final String bgsImage = bgsImageName; if ( civ != null && fbwName.equals( fbwImage ) && bbwName.equals( bbwImage ) && bgsName.equals( bgsImage ) ) { // civ is a CheckImageViewer (a JFrame that is extended to produce an image manipulation tool) civ.show(); return; } else { fbwName = fbwImage; bbwName = bbwImage; bgsName = bgsImage; } Runnable r = new Runnable() { BufferedImage front=null, backBW=null, backGS=null; URL fbwURL = null, bbwURL = null, bgsURL = null; public void run() { thisApplet.showStatus( "loading image applet..." ); if ( fbwImage != null ) { try { fbwURL = new URL( getDocumentBase(), fbwImage ); } catch( MalformedURLException mfue1 ) { fbwURL = null; } } if ( bbwImage != null ) { try { bbwURL = new URL( getDocumentBase(), bbwImage ); } catch( MalformedURLException mfue2 ) { bbwURL = null; } } if ( bgsImage != null ) { try { bgsURL = new URL( getDocumentBase(), bgsImage ); } catch( MalformedURLException mfue3 ) { bgsURL = null; } } /* so that the applet doesn't try to write files to disk, which is a security violation */ if ( ImageIO.getUseCache() ) ImageIO.setUseCache( false ); //now, try to read each file if appropriate. if ( bbwURL != null ) { try { backBW = ImageIO.read( bbwURL ); } catch( Exception e2 ) { backBW = null; } } if ( bgsURL != null ) { try { backGS = ImageIO.read( bgsURL ); } catch( Exception e3 ) { backGS = null; } } if ( fbwURL != null ) { try { front = ImageIO.read( fbwURL ); } catch( Exception e1 ) { front = null; } } if ( civ==null ) { civ = new CheckImageViewer( front, backBW, backGS ); } else { civ.replaceImages( front, backBW, backGS ); } thisApplet.showStatus( "" ); } }; Thread internalThread = new Thread( r ); internalThread.start(); } The strange thing is that when this method is called the second time, it occasionally loads one of the images correctly, but this is a random occurrence. However, if I close and restart my browser, the applet will always work fine on the next call to manipulateImages(). Am I doing anything wrong in my use of ImageIO.read() ? Do I need to reset something between uses of the static method? Please help me! I'm going to get a concussion from banging my head against the wall :-( =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".