• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

Copy of a BufferedImage object

How can I get exact copy of a BufferedImage object?
Also, can anyone please tell me the differences and advantages between BufferedImage and Image? When is the appropriate time to use the BufferedImage?

1 Solution
I'm not an expert on BufferedImage, a complex class, about which a respected writer of a book on Java2D graphics says a whole book could be written on it alone, but an obvious advantage of using BufferedImage gives you much more control over the constituents of the image.

You can clone an existing one by calling getSubimage(0, 0, image.getWidth(), image.getHeight())
getSubimage() returns a pointer to the data of the existing BI. Making a change to either changes both. I need a separate BI so that I can make changes (e.g., color) to one and not affect the other.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now