Skip to content

Instantly share code, notes, and snippets.

@sharish
Created July 25, 2015 04:30
Show Gist options
  • Save sharish/d1f7da17d09853bea300 to your computer and use it in GitHub Desktop.
Save sharish/d1f7da17d09853bea300 to your computer and use it in GitHub Desktop.
int leftOffset = 0; // your left offset in pixels
int topOffset = 0; // your top offset in pixels
float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
task.setBaseBitmap(baseBitmap)
.setMergeBitmap(mergeBitmap)
.setMergeListener(new BitmapMergerTask.OnMergeListener() {
@Override
public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
if(imgView != null) {
imgView.setImageBitmap(mergedBitmap);
}
}
})
.setScale(scale)
.setOffsets(leftOffset,topOffset)
.merge();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment