Java SDK/VM errors in BufferedImage.getSubimage
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sun-java6 (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: sun-java6-jdk
I am developing an application which manipulates images and have found two cases where the class method BufferedImage.
"java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)"
Case 1. When the source BufferedImage which has been read in is a jpeg file, .getSubimage works as specified. When the source is a GIF file, getSubimage respects the width and height parameters, but uses the top left coordinate of the source image to create the destination, regardless of parameter values. This behaviour exists with all files I have tested.
Case 2. When destination BufferedImage has been created by getSubimage, and is used as the input to a WarpPerspective operation via JAI, and the resulting PlanarImage is converted back to a BufferedImage using the PlanarImage.
The workarounds are to use jpeg files and an intermediate write to disk, but this is unsatisfactory because the jpeg files are lossy, which is important for this application, and for performance reasons - the application will be processing thousands of small files.
The Exception caused in Case 2 is:
Exception in thread "AWT-EventQueue-0" java.lang. NullPointerExce ption media.jai. iterator. RandomIterFallb ack.makeCurrent (RandomIterFall back.java: 110) media.jai. iterator. RandomIterFallb ack.getSample( RandomIterFallb ack.java: 117) media.jai. opimage. WarpNearestOpIm age.computeRect Byte(WarpNeares tOpImage. java:176) media.jai. opimage. WarpNearestOpIm age.computeRect (WarpNearestOpI mage.java: 99) jai.WarpOpImage .computeTile( WarpOpImage. java:577) media.jai. util.SunTileSch eduler. scheduleTile( SunTileSchedule r.java: 904) jai.OpImage. getTile( OpImage. java:1129) jai.PlanarImage .copyData( PlanarImage. java:2343) jai.PlanarImage .getAsBufferedI mage(PlanarImag e.java: 2525) jai.PlanarImage .getAsBufferedI mage(PlanarImag e.java: 2546)
at com.sun.
at com.sun.
at com.sun.
at com.sun.
at javax.media.
at com.sun.
at javax.media.
at javax.media.
at javax.media.
at javax.media.