Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write text over a picture in Android and save it?

Tags:

How can I write text on an image and then save it in Android?

Basically I want to let user write something on the images which my camera app will click for them. I can write and show it to them using the onDraw method on the preview of the camera. But after the user has clicked the picture I want to write the text over the picture and then save it.

like image 765
nasaa Avatar asked May 28 '11 01:05

nasaa


People also ask

How do I write text on a picture on Android?

On your Android phone, open your Google Photo App. It'll load the pictures automatically; click on the one you wish to add text on. You'll see options below the picture; click on Edit.

How do you put text over an image?

On the Insert tab, in the Text group, click Text Box, click anywhere near the picture, and then type your text. To change the font or style of the text, highlight the text, right-click it, and then select the text formatting you want on the shortcut menu.

What app can I use to write on my pictures?

Canva. Canva is an online app with tons of filters and design tools to ensure your images look incredible. You'll have to create an account to use it, but setting it up is not going to take a long time. In order to add text to your photo, all you have to do is click on “Add text” and customize it to your liking.


2 Answers

You can put an EditText and write into it, and after writing, you first convert it to Bitmap like:

Bitmap bmp = Bitmap.createBitmap(mEditText.getDrawingCache()); 

Now you can add created image bmp to your original image like this:

Call: Bitmap combined = combineImages(bgBitmap,bmp);

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;     } 
like image 172
MKJParekh Avatar answered Oct 12 '22 19:10

MKJParekh


You have to implement a canvas that allows the user to draw on it and then set the background of that canvas to that particular image. This is just a guess but its somewhere there abouts.

like image 24
JoxTraex Avatar answered Oct 12 '22 18:10

JoxTraex