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

The JPEG encoder reserves a lot of memory to convert large BGR images

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.1.2
    • client-libs
    • 2d
    • x86
    • windows_xp

      Name: rmT116609 Date: 08/12/2004


      A DESCRIPTION OF THE REQUEST :
      When trying to convert a large image to a JPEG image, the encoder seems to reserve all the needed memory to keep the whole image in memory. So, for large images, it is impossible to convert the image to JPEG if you do not have enough memory to keep it in memory. For other formats (TIFF, BMP, PNG...) it does not occur.


      JUSTIFICATION :
      The JAI should deal with large images.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The amount of memory reserved for the encoding of a JPEG image should not be proportional to the size of the image being covnverted
      ACTUAL -
      The amount of memory reserved for the encoding of a JPEG image IS proportional to the size of the image being covnverted

      ---------- BEGIN SOURCE ----------

            //This is an extract of code that convert a TIFF to JPEG
            ParameterBlock pb3 = new ParameterBlock();
            pb3.add(new FileSeekableStream(tempTiff));
            RenderedOp rendOp = JAI.create("tiff", pb3);
            ParameterBlock pb4 = new ParameterBlock();
            pb4.addSource(rendOp);
            pb4.add(salidaJPEG);
            pb4.add("jpeg");
            JPEGEncodeParam encParam2 = new JPEGEncodeParam();
            encParam2.setQuality(calidad);
            pb4.add(encParam2);
            JAI.create("filestore", pb4);

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

      CUSTOMER SUBMITTED WORKAROUND :
      Surprisingly, the old JIMI library seems not to have this probles, though it does not compile correctly in JDK 1.4
      (Incident Review ID: 290143)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: