Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6266748
Votes 0
Synopsis JPEGImageWriter.write() makes a copy of the raster (inefficient)
Category java:imageio
Reported Against
Release Fixed mustang(b56)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 6268083
Submit Date 06-MAY-2005
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.
  xxxxx@xxxxx   2005-05-06 20:43:42 GMT
Work Around
N/A
Evaluation
See suggested fix.
  xxxxx@xxxxx   2005-05-06 20:46:40 GMT
The "minor change" suggested in the description field is just what we have
currently in JPEGImageWriter, so perhaps the submitter was looking at an
old version of JPEGImageWriter.  In any case, the full suggested fix would
probably help improve performance for simple RenderedImages, so it's still
worth pursuing.
Posted Date : 2005-09-29 19:39:11.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang