-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0, 5.0
-
b03
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2178175 | 7 | Andrew Brygin | P4 | Resolved | Fixed | b63 |
The specification for param.setDestination() claims that the destination specified must be one of the type specifiers returned by reader.getImageTypes(). JPEGImageReader returns 3 destination image types.
TYPE_3BYTE_BGR, TYPE_BYTE_GRAY and TYPE_CUSTOM. Out of these, when i set the destination to TYPE_BYTE_GRAY, i am getting an illegal argument exception saying the no. of source and destination bands differ. I created this destination buffered image through ImageTypeSpecifier.createBufferedImage() and I expect the type specifier to handle such incompatibilites. The specification gives an impression that setting a destination will work fine if it is one of the types returned by getImageTypes(). It does not say that the application has to handle the band incompatibilities between the source and destination images. This seem to work fine for all other readers and all other image types returned by getImageTypes().
This is reproducible on all platforms right from JDK1.4+.
I have attached a sample code. Execute the sample code as follows.
java SetDestinationTest <img file>
Choose the buffered image type from the drop-down. For JPEG, if you choose the TYPE_BYTE_GRAY buffered image, you will get an IllegalArgumentException. Try with other image types and compare the behavior.
TYPE_3BYTE_BGR, TYPE_BYTE_GRAY and TYPE_CUSTOM. Out of these, when i set the destination to TYPE_BYTE_GRAY, i am getting an illegal argument exception saying the no. of source and destination bands differ. I created this destination buffered image through ImageTypeSpecifier.createBufferedImage() and I expect the type specifier to handle such incompatibilites. The specification gives an impression that setting a destination will work fine if it is one of the types returned by getImageTypes(). It does not say that the application has to handle the band incompatibilities between the source and destination images. This seem to work fine for all other readers and all other image types returned by getImageTypes().
This is reproducible on all platforms right from JDK1.4+.
I have attached a sample code. Execute the sample code as follows.
java SetDestinationTest <img file>
Choose the buffered image type from the drop-down. For JPEG, if you choose the TYPE_BYTE_GRAY buffered image, you will get an IllegalArgumentException. Try with other image types and compare the behavior.
- backported by
-
JDK-2178175 JPEGReader throws IllegalArgException when setting the destination to BYTE_GRAY
-
- Resolved
-
- duplicates
-
JDK-6515852 JPEG Reader throws IllegalArgumentException when setting the dest type to TYPE_3BYTE_BGR
-
- Closed
-
- relates to
-
JDK-4884308 IllegalArgExptn thrown when reading image using TYPE_BYTE_GRAY after TYPE_CUSTOM
-
- Open
-
-
JDK-6395551 Setting destination type to type specifier returned by redr.getImageTypes() throws exception for JPG
-
- Closed
-