Skip to Main Content

New to Java

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!

How to clone a java.awt.BufferedImage?

807599Apr 26 2007 — edited May 11 2008
private BufferedImage originalImage;
private BufferedImage copiedImage;

public MyClass(BufferedImage image) {

originalImage = image;
copiedImage= originalImage .clone();

}

The issue is that BufferedImage.clone does not exist.

When I just do this:

copiedImage= originalImage;

then when I modify the copied image I am also modifying the orriginal.

I know I am dealing with a pointer with the BufferedImage, but I am not sure how to get around it at this point.

Thanks,
Justus
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2008
Added on Apr 26 2007
7 comments
818 views