Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4430355

readParam.setDestinationType() throws IIOException for PNG and GIF.

XMLWordPrintable

      Setting the destination type to the first image type specifier returned from
      reader.getImageTypes() throws an IIOException saying that the destination type does not match. This is noticed for GIF and PNG whereas it works fine for JPEG.

      It is specified in the document that the first element of the iterator returned
      by reader.getImageTypes() should be the most "natural" type for decoding the image with as little loss as possible. But when i try to read the image using an image read param with destinationType() set to the first element of the returned
      iterator, the following exception is thrown.

      javax.imageio.IIOException: Destination type from ImageReadParam does not match!
              at javax.imageio.ImageReader.getDestination(ImageReader.java:2668)
              at com.sun.imageio.plugins.gif.GIFImageReader.read(GIFImageReader.java:958)
              at ImgParamReaderTest.start(ImgParamReaderTest.java:119)
              at ImgParamReaderTest.<init>(ImgParamReaderTest.java:65)
              at ImgParamReaderTest.main(ImgParamReaderTest.java:132)
      This is noticed on all the platforms for Merlin-beta build 57.
      I tried this with both the default param as well as newly created read param
      and the result is same.

      How to reproduce the bug :
      Compile the attached .java file and run it. it will display the Sample Model and
      Color Model of the ImageTypeSpecifier returned from getImagetypes() and also
      it wil display the Color and Sample Model of the image read. If you get the
       exception then the bug is reproduced.

            dricesunw Daniel Rice (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: