Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Image or BufferedImage

807605Jul 25 2007 — edited Jul 25 2007
Trying to write an application that displays a lot of images. Images would essentially be drawn onto JPanels. Was wondering what are the implications of using BufferedImage over Image. As far as I know BufferedImage are handy if you wanna gain access to the pixels. Is there any other good reason to consider using BufferedImage instead of Image? Would there be cost or benefit in performance when I have a class that holds and displays BufferedImage instead of just using Image?

Also, found that for relatively large images, using the following code to convert an Image to BufferedImage can take up to several minutes. Does anybody know a way to speed things up?

BufferedImage bi = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
tracker.addImage(bi, 0);
Graphics g = bi.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
tracker.waitForID(0);

Many thanks on any advice you can give.

Jeev
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2007
Added on Jul 25 2007
3 comments
333 views