Merge two bitmaps in android

前端 未结 4 2029
既然无缘
既然无缘 2020-12-05 08:23

I want to merge two bitmaps, here is my code

// Camera arg conversion to Bitmap
                    Bitmap cameraBitmap = BitmapFactory.decodeByteArray(arg0,         


        
4条回答
  •  情深已故
    2020-12-05 09:15

    Merging Two Bitmap vertically when one is large and second is small
    follow this method

     public Bitmap finalcombieimage(Bitmap c, Bitmap s) {
        Bitmap cs = null;
        DisplayMetrics metrics = getBaseContext().getResources().getDisplayMetrics();
        int width = metrics.widthPixels;
        int height = metrics.heightPixels;
        cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas comboImage = new Canvas(cs);
        Rect dest1 = new Rect(0, 0, width, height); // left,top,right,bottom
        comboImage.drawBitmap(c, null, dest1, null);
        Rect dest2 = new Rect(0, height-400 / 2, width, height);
        comboImage.drawBitmap(s, null, dest2, null);
        return cs;
    }
    

提交回复
热议问题