-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2, 6
-
b77
-
generic
-
generic
-
Verified
I am creating an IIS from the given jpg image and getting the corresponding reader from ImageIO. Calling ImageReader.getImageTypes(0) returns 4 ImageTypeSpecifiers (2 types of 3BYTE_BGR, 1 BYTE_GRAY and 1 TYPE_CUSTOM). I am setting the destination type to the first returned image type specifier by calling param.setDestinationType(typeSpecifier) and using this param to read the image. ImageReader throws IIOException saying the destination type specified in the param does not match.
This is incorrect. The first type specifier returned by getImageTypes() is supposed to be the most appropriate destination type for the given image. Setting the destination type to the second type specifier in the returned array works fine (which is also 3BYTE_BGR).
javax.imageio.IIOException: Destination type from ImageReadParam does not match!
at javax.imageio.ImageReader.getDestination(ImageReader.java:2862)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:892)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
at KannanImageIOTest.<init>(KannanImageIOTest.java:53)
at KannanImageIOTest.main(KannanImageIOTest.java:116)
This is reproducible on all platforms atleast since 1.4.2.
I have attached a sample test. Execute the sample test, passing the given image as an argument. You would see the original image loaded in the top (labelled 'Original'). This is read through Toolkit API. Below that, you are supposed to see a grid of 3x3 images (total 9 images). First image on the first row would be the output of setDestinationType, second one on the first row would be setDestination (typeSpecifier.createBufferedImage) and third image on the first row would be setDestination (new BufferedImage(x,y, type.getBufImageType())). The first image will not be loaded in this case because of the above exception.
Second and third rows represents the second and third image type specifiers returned by getImageTypes(). TYPE_CUSTOM is skipped since it takes huge time to load the image.
This is incorrect. The first type specifier returned by getImageTypes() is supposed to be the most appropriate destination type for the given image. Setting the destination type to the second type specifier in the returned array works fine (which is also 3BYTE_BGR).
javax.imageio.IIOException: Destination type from ImageReadParam does not match!
at javax.imageio.ImageReader.getDestination(ImageReader.java:2862)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:892)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
at KannanImageIOTest.<init>(KannanImageIOTest.java:53)
at KannanImageIOTest.main(KannanImageIOTest.java:116)
This is reproducible on all platforms atleast since 1.4.2.
I have attached a sample test. Execute the sample test, passing the given image as an argument. You would see the original image loaded in the top (labelled 'Original'). This is read through Toolkit API. Below that, you are supposed to see a grid of 3x3 images (total 9 images). First image on the first row would be the output of setDestinationType, second one on the first row would be setDestination (typeSpecifier.createBufferedImage) and third image on the first row would be setDestination (new BufferedImage(x,y, type.getBufImageType())). The first image will not be loaded in this case because of the above exception.
Second and third rows represents the second and third image type specifiers returned by getImageTypes(). TYPE_CUSTOM is skipped since it takes huge time to load the image.
- duplicates
-
JDK-6357444 JPEG: setDestinationType() causes IOException in case of embedded ICC profile.
-
- Closed
-
- relates to
-
JDK-4893408 JPEGReader throws IllegalArgException when setting the destination to BYTE_GRAY
-
- Resolved
-