I am trying to make an image editing software for my final semester project. I am stucked in finding out the method on how to duplicate or clone an Image. I have been looking for the algorithms used.. I searched the internet, also gone through few computer graphics books but could not get through.
Asked
Active
Viewed 187 times
1 Answers
0
You can try something like this:
public class ImageDuplicateHelper {
public BufferedImage duplicate(BufferedImage bi) {
ColorModel cm = bi.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = bi.copyData(null);
return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
}
}
// ...
BufferedImage img = ImageIO.read(...);
BufferedImage duplicatedImg = duplicate(img);

Stephan
- 41,764
- 65
- 238
- 329