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

PNGImageWriter incorrectly applies/not applies filter to pixels

    Details

    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, linux, windows_xp

      Description

      Name: rmT116609 Date: 02/05/2004


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)



      FULL OPERATING SYSTEM VERSION :
      glibc-2.2.2
      Linux 2.4.19 i686
      Slackware-based

      A DESCRIPTION OF THE PROBLEM :
      The size of the PNG images created by PNGImageWriter is
      considerably
      larger than created by other PNG creation tools such as gif2png,
      Netpbm, etc., for the same image contents.

      By inspecting PNG images generated by PNGImageWriter, following
      problems were found. For indexed color images (color type 3),
      adaptive filter (filter type 1-4) is applied to the scanlines.
      So the randomness of the filtered data increases, and
      the compression ratio is dropped. According to the
      PNG Specification (http://www.libpng.org/pub/png/spec/),
      filter type 0 is recommended for the indexed color images.

      Conversely, for true color images (color type 2) generated by
      PNGImageWriter, filter type 0 is only applied. PNG Spec
      recommends
      to apply adaptive filter to true color images.

      This problem is because, the logic to test if input image is
      indexed-colored or not is backward, in the implementation of
      com.sun.imageio.plugins.png.RowFilter#filterRow(int,byte[],byte[],byte[][],int,int).

      Currently:
              // Use type 0 for palette images
              if (colorType != PNGImageReader.PNG_COLOR_PALETTE) {
      Should:
              // Use type 0 for palette images
              if (colorType == PNGImageReader.PNG_COLOR_PALETTE) {


      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Incident Review ID: 181605)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bae Andrew Brygin
                Reporter:
                rmandalasunw Ranjith Mandala (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: