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

JPEGImageWriter.write() makes a copy of the raster (inefficient)

XMLWordPrintable

    • 1.4
    • b56
    • generic
    • solaris_9

      This statement

                       // XXX - this makes a copy, which is memory-inefficient
                       srcRas = rimage.getData();

      in JPEGImageWriter is really lame. If the source is a BufferedImage it is
      going to copy the entire thing in memory. If it is an untiled JAI image this
      should not happen (a child of the tile would be returned instead of copying).

      Nonetheless I would suggest changing this to the code listed below. If a more
      minor change would get in to the next build sooner then I would suggest this
      instead:

        srcRas = rimage instanceof BufferedImage ?
        srcRas = ((BufferedImage)rimage).getRaster() :
        rimage.getData();

      which should solve most of the problem.
      ###@###.### 2005-05-06 20:43:42 GMT

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: