android - Merge two bitmap data -



android - Merge two bitmap data -

for application, have create 2 bitmap per requirements.

one actual image goes through image processing , sec logo bitmap display application logo on top left corner.

now @ saving time want combine these bitmaps , want generate single jpeg file output.

to accomplish task have write next code.

orignalbitmap = orignalbitmap.copy(config.argb_8888, true); canvas savedcanvas = new canvas(orignalbitmap); savedcanvas.setbitmap(logobitmap); savedcanvas.drawbitmap(orignalbitmap, 0, 0, transpaint); savedcanvas.drawbitmap(logobitmap, 0, 0, transpaint); seek { orignalbitmap.compress(compressformat.jpeg, 100, new fileoutputstream(new file("/mnt/sdcard/original.jpg"))); } grab (filenotfoundexception e) { e.printstacktrace(); }

but @ nowadays got original image output not attached logo. want image logo info available in logo bitmap. how combine both bitmaps info can't understand please provide guidance in this.

use function combine 2 bitmap in single bitmap

public static bitmap combineimages(bitmap c, bitmap s) { bitmap cs = null; int width, height = 0; if(c.getwidth() > s.getwidth()) { width = c.getwidth() + s.getwidth(); height = c.getheight(); } else { width = s.getwidth() + s.getwidth(); height = c.getheight(); } cs = bitmap.createbitmap(width, height, bitmap.config.argb_8888); canvas comboimage = new canvas(cs); comboimage.drawbitmap(c, 0f, 0f, null); comboimage.drawbitmap(s, c.getwidth(), 0f, null); homecoming cs; }

android file canvas bitmap android-bitmap

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -