Android Rao
Android Rao

Reputation: 157

How can i have image (takePicture) with text at the bottom of it. Eg. Date time

I would like to add the text to be part of my image. Eg. Date and time, or "You are using the Free version". Is it possible....? Please help me. Thanks in advance.

Upvotes: 0

Views: 272

Answers (2)

Android Rao
Android Rao

Reputation: 157

Thanks Gabriel for the right direction: Following code helped me.

     public static Bitmap WaterMark(Bitmap src, String watermark,int x, int y,  int size) {
        int w = src.getWidth();
        int h = src.getHeight();
    //  TML_Library.Debug("Image Width = "+w+" Image Height = "+h);
        Bitmap result = Bitmap.createBitmap(w, h, src.getConfig());

        Canvas canvas = new Canvas(result);
        canvas.drawBitmap(src, 0, 0, null);
        Paint paint = new Paint();
        paint.setTextSize(size);

        paint.setColor(Color.rgb(255, 0, 0));

        paint.setAntiAlias(true);

        canvas.drawText(watermark, x, y, paint);

        return result;
    }   

Upvotes: 0

Gabriel Negut
Gabriel Negut

Reputation: 13960

Use a Canvas and drawText.

Upvotes: 2

Related Questions