Reputation:
I try to pick an image from gallery and add some text on it then save it. Can you tell me where should i look or what library shoul i use? I am using Android Studio 2.2
Upvotes: 0
Views: 114
Reputation: 703
Firstly, you can put an EditText and write into it, and after writing, you first convert it to Bitmap like below
Bitmap bitmap = Bitmap.createBitmap(mEditText.getDrawingCache());
Now you can add created image bitmap to your original image like this
Bitmap combined = combineImages(bgBitmap,bitmap);
public Bitmap combineImages(Bitmap background, Bitmap foreground) {
int width = 0, height = 0;
Bitmap cs;
width = getWindowManager().getDefaultDisplay().getWidth();
height = getWindowManager().getDefaultDisplay().getHeight();
cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(cs);
background = Bitmap.createScaledBitmap(background, width, height, true);
comboImage.drawBitmap(background, 0, 0, null);
comboImage.drawBitmap(foreground, matrix, null);
return cs;
}
I hope it helps.
Upvotes: 1