Android Example Add text to image and save it ("water mark")

Hi all.
I found this example in some old folders on my pc and decided to share here.
it is a simple example of how add a text into a bitmap and later save it as image file.




Download Here 640kb



........
 

Ferdari

Active Member
Licensed User
Longtime User
Hi all.
I found this example in some old folders on my pc and decided to share here.
it is a simple example of how add a text into a bitmap and later save it as image file.

View attachment 73393


Download Here 640kb



........
Hi @Douglas Farias, it helped me a lot, i modified a bit to add image watermark on corner:

B4X:
    Public wrect As Rect
   'ADICIONAMOS O TEXTO CENTRALIZADO EM BAIXO DA IMAGEM
       b = ImageView1.Bitmap
    Public w As Bitmap
    w = LoadBitmapResize(File.DirAssets,"mred.png",ImageView1.Width - 128,ImageView1.Height - 128,True)
       brect.Initialize(0,0,ImageView1.Width, ImageView1.Height)
    wrect.Initialize(  ImageView1.Width - 128, ImageView1.Height - 128,  ImageView1.Width, ImageView1.Height)
    canvas.Initialize(ImageView1)
       canvas.DrawColor(Colors.White)
       canvas.DrawBitmap(b, Null, brect)
       canvas.DrawBitmap(w, Null, wrect)
       'canvas.DrawText(EditText1.Text, ImageView1.Width/2 , ImageView1.Height - 20dip ,Typeface.DEFAULT , 15, Colors.Blue, "CENTER") 'O CENTER SERIA IGUAL CENTRALIZAR UMA LABEL.
    ImageView1.Invalidate
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…