Public bug reported:

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.

** Affects: sun-java6 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Java SDK/VM errors in BufferedImage.getSubimage
https://bugs.launchpad.net/bugs/241346
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to