byungkyu
byungkyu

Reputation: 211

how to compose(combine) two photo image in android?

Hello I need to make DRM Image file using two image file. originally I was use bufferedImage class, but android is not support bufferedImage.

so please help me. how to compose two image in android?

Upvotes: 4

Views: 2937

Answers (1)

Zelimir
Zelimir

Reputation: 11028

You can do that if you overlay two images. Suppose that bmp1 is bigger one (to be protected), and bmp2 is marker:

private Bitmap overlayMark(Bitmap bmp1, Bitmap bmp2) 
{ 
    Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig()); 
    Canvas canvas = new Canvas(bmOverlay); 
    canvas.drawBitmap(bmp1, 0, 0, null);
    canvas.drawBitmap(bmp2, distanceLeft, distanceTop, null);
    return bmOverlay; 
} 

distanceLeft and distanceTop define position of the marker.

Upvotes: 3

Related Questions