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

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

    Details

    • Subcomponent:
    • Introduced In Build:
      1.4
    • Introduced In Version:
    • Resolved In Build:
      b56
    • CPU:
      generic
    • OS:
      solaris_9

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: