combining two png files in android

后端 未结 6 1645
星月不相逢
星月不相逢 2020-11-30 23:32

I have two png image files that I would like my android app to combine programmatically into one png image file and am wondering if it is possible to do so? if so, what I w

6条回答
  •  清歌不尽
    2020-11-30 23:43

    Try this .

    public Bitmap mergeBitmap(Bitmap frame, Bitmap img){
    
        Bitmap bmOverlay = Bitmap.createBitmap(frame.getWidth(), frame.getHeight(), frame.getConfig());
        Canvas canvas = new Canvas(bmOverlay);
        canvas.drawBitmap(img, 0, 0, null);
        canvas.drawBitmap(frame, new Matrix(), null);
    
        return bmOverlay;
    
    }
    

    Returns a bitmap image

    Pass two bitmap images to your function as shown below

    Bitmap img= mergeBitmap(imgone, imagetwo);
    

    See the entire post or also see merge multiple images in android programmatically

提交回复
热议问题