Java SDK/VM errors in BufferedImage.getSubimage

Bug #241346 reported by MikeCalder
2
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.getSubimage(...) does not perform correctly. This may be a problem with the SDK, or the Java VM, or support libraries - I am not competent to tell. My environment is AMD64 Hardy Heron 8.04 Kubuntu 3.5.9 fully up to date with all online changes. I have the Sun 6 java SDK installed, and the VM reported from "java -version" is

"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.getAsBufferedImage method, regardless of the type of the original source BufferedImage, jpeg or gif, the PlanarImage.getAsBufferedImage method fails with a Null Pointer Exception. However, If the subimage is first read out to a disk file, and a new BufferedImage read in from that file, and subjected to the identical Warp and PlanarImage code, it works according to specification without an Exception. This would seem to indicate to me that either the getSubimage method is creating an imperfect BufferedImage, or a version with options or parameters that PlanarImage.getAsBufferedImage cannot properly interpret. In light of Case 1, I suspect the former.

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.

Revision history for this message
MikeCalder (michaelcalder) wrote :

The Exception caused in Case 2 is:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.media.jai.iterator.RandomIterFallback.makeCurrent(RandomIterFallback.java:110)
at com.sun.media.jai.iterator.RandomIterFallback.getSample(RandomIterFallback.java:117)
at com.sun.media.jai.opimage.WarpNearestOpImage.computeRectByte(WarpNearestOpImage.java:176)
at com.sun.media.jai.opimage.WarpNearestOpImage.computeRect(WarpNearestOpImage.java:99)
at javax.media.jai.WarpOpImage.computeTile(WarpOpImage.java:577)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at javax.media.jai.PlanarImage.copyData(PlanarImage.java:2343)
at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2525)
at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2546)

Revision history for this message
Matthias Klose (doko) wrote :

please recheck with 6-07 in intrepid

Changed in sun-java6:
status: New → Incomplete
Revision history for this message
MikeCalder (michaelcalder) wrote :

I don't have intrepid.

Basically, you're saying there's going to be no fix to the current release (Ubuntu 8.04), and it may or may not be fixed in the next version, but you don't know?

Whoopty-doo.

Revision history for this message
Matthias Klose (doko) wrote :

this is your interpretation or whatever; I did ask a question.

fyi, you can setup a development environment using debootstrap. see https://wiki.ubuntu.com/DebootstrapChroot

Revision history for this message
Dimitrios Symeonidis (azimout) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue for you. Can you try with the latest Ubuntu release? Thanks in advance.

Revision history for this message
etali (etali) wrote :

We'd like to figure out what's causing this bug for you, but we haven't heard back from you in a while. Could you please provide the requested information? Thanks!

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for sun-java6 (Ubuntu) because there has been no activity for 60 days.]

Changed in sun-java6 (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.