Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4674968

BufferedImage should support TYPE_3BYTE_RGB

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 1.4.0, 15
    • client-libs
    • 2d
    • sparc
    • solaris_7



      Name: jk109818 Date: 04/25/2002


      FULL PRODUCT VERSION :
      lowe% java -version
      java version "1.3.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
      Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
      lowe%

      This also applies to 1.4. The javadocs indicate the issue still exists.


      FULL OPERATING SYSTEM VERSION :

      lowe% uname -a
      SunOS lowe 5.7 Generic_106541-16 sun4u sparc SUNW,Ultra-5_10
      lowe%

      ADDITIONAL OPERATING SYSTEMS :

      Any. This is not an OS-specific issue.


      A DESCRIPTION OF THE PROBLEM :
      BufferedImage supports TYPE_3BYTE_BGR, but does not support
      TYPE_3BYTE_RGB. While a 3-byte RGB image can be implemented
      using TYPE_CUSTOM, a specific type for this case would be
      helpful. Java Advanced Imaging (JAI) uses these 3-byte RGB
      images quite extensively, for images read from a number of
      different file formats (color png, pnm, tiff, and fpx
      images, at least).

      Because of its extensive use in JAI, this case should also
      be accelerated in the Java2D image drawing pipeline, if it
      is not already.

      The test program requires JAI and takes a single filename as
      its argument, creates a BufferedImage from it, and prints
      out the BufferedImage type.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Load any of several image types via JAI and print out the
      buffered image type (see sample program). Color images of
      type png, ppm, tiff, and fpx at least turn out TYPE_CUSTOM.
      Closer analysis shows they are compatible with
      TYPE_3BYTE_RGB.
      2. Note in the javadoc for BufferedImage that TYPE_3BYTE_RGB
      is not supported.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      They should end up as a new TYPE_3BYTE_RGB instead of
      TYPE_CUSTOM.


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.media.jai.*;
      import java.awt.image.*;

      public class BufferedImage3ByteRGBTestCase {
          public static void main(String argv[])
          {
              BufferedImage img = JAI.create("fileload",argv[0]).getAsBufferedImage();
              System.out.println("type = " + img.getType());
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      None. Note that Apple's Java2D implementation currently
      does not support TYPE_CUSTOM, which is a major factor in JAI
      not working on OS X.
      (Review ID: 144977)
      ======================================================================

            Unassigned Unassigned
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: