JDK-6585922 : ImagingOpException from ConvolveOp when input BufferedImage is TYPE_3BYTE_BGR
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.2,6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic
  • Submitted: 2007-07-26
  • Updated: 2011-01-19
  • Resolved: 2007-09-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b20Fixed
Related Reports
Duplicate :  
Relates :  
Description
The attached test case calls ConvolveOp.filter() on a BufferedImage which
is returned from ImageIO as TYPE_3BYTE_BGR. The test throws an exception as follows :

java ConvolveOpTest
Exception in thread "main" java.awt.image.ImagingOpException: Unable to convolve src image
        at java.awt.image.ConvolveOp.filter(ConvolveOp.java:180)
        at ConvolveOpTest.testConvolveIdentitySample(ConvolveOpTest.java:25)
        at ConvolveOpTest.main(ConvolveOpTest.java:9)

Comments
EVALUATION The root of the problem is that createCompatibleDestImage() of ConvolveOp class creates buffered image of custom type (in fact it could be named as TYPE_3BYTE_RGB) as compatible destination for TYPE_3BYTE_BGR image. It happens because images of these types has exactly same color models and only difference is in raster structure. So, approach based on utilization of ColorModel.createComaptibleWritableRaster() can not work here. We may workaround this problem using createCompatibleWritableRaster() of source image raster. It allows us to inherit correct raster organization and produce destination image with exactly same structure. Problem with using custom destination image is covered by CR 4886732. Suggested fix for 4886732 solves problem with 3BYTE_BGR source and 3BYTE_RGB destination as with many other cases.
08-08-2007