Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How might I add a watermark effect to an image in Android?

Tags:

I have an image with frames and I need to add a watermark effect. How might I do this?

like image 595
info Avatar asked May 21 '12 04:05

info


People also ask

Does Android have a watermark?

The Watermark settings is a new useful feature available on the Galaxy devices operating on One UI 5.0. Once you have enabled this setting, you will be able to view the Watermark at the bottom of your newly captured photo.


1 Answers

I found great tutorial on Android Image Processing here.

public static Bitmap mark(Bitmap src, String watermark, Point location, Color color, int alpha, int size, boolean underline) {
    int w = src.getWidth();
    int h = src.getHeight();
    Bitmap result = Bitmap.createBitmap(w, h, src.getConfig());

    Canvas canvas = new Canvas(result);
    canvas.drawBitmap(src, 0, 0, null);

    Paint paint = new Paint();
    paint.setColor(color);
    paint.setAlpha(alpha);
    paint.setTextSize(size);
    paint.setAntiAlias(true);
    paint.setUnderlineText(underline);
    canvas.drawText(watermark, location.x, location.y, paint);

    return result;
}

Thanks to Pete Houston who shares such useful tutorial on basic image processing.

like image 156
AndroidLearner Avatar answered Nov 02 '22 20:11

AndroidLearner