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

2D renderings saved using JPG writer could not be retrieved by getImage() method

XMLWordPrintable

    • rc1
    • generic
    • generic
    • Verified

      I am rendering different kinds of shapes and fonts on to the graphics context
      of the buffered image and i am saving this buffered image in JPEG and PNG
      formats using the JPEG and PNG writers available in ImageIO. I am trying this
      with all kinds of buffered images.
      2D renderings saved using JPEG writer are not proper when i use the following
      kinds of buffered images.
      1. TYPE_INT_ARGB
      2. TYPE_INT_ARGB_PRE
      3. TYPE_4BYTE_ABGR
      4. TYPE_4BYTE_ABGR_PRE
      5. TYPE_USHORT_GRAY

      I could not retrieve the image back from the image file using Toolkit's
       getImage() method. When i use this method i am getting an ImageFormatException:
      Unsupported color conversion request. When i opened these images using the
       browser(netscape), the contents of the image are totally different and
      I could see lot of horizontal and vertical lines running throughout the image.
      But i could read the image back using ImageIO itself but even then the colors
      are totally different. For USHORT_GRAY buff image, application is crashing on
      all the platforms when i use JPEG writer and a bug has already been filed on
       this. Toolkit's getImage() method should be able to read any image written
      using ImageIO as long as java supports that particular image format.

      How to reproduce the bug :
      Herewith I have enclosed my testcase. Save the java and html file in the same
      dir. Create a dir - resources under the same dir and save the properties file
      inside that dir. Compile the java file and give the following command.
      appletviewer -Xnosecurity *.html

      You would get a frame with 4 radio buttons and 3 buttons. Follow the
       instructions shown in the instruction dialog and click accordingly. You would
      get 3 images where first image is the buffered image, second image is the one
      read by ImageIO reader and third image is the one read using getImage().
      All those images are stored in the current directory for your verification.

      I tested this with build-63 and also with 2 previous builds. This bug
      occurs on all the platforms with both client and server VMs.
      This feature works fine for PNG. I have also attached the log file created by
      the JVM when the appln crashed for USHORT_GRAY.

            campbell Christopher Campbell (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: