0

I'd like to know how do i water mark the camera while taking a picture. I wanna put a image already taken to be like a map to the person who's taking the new picture. I'm using android studio to do it. Like this: I'm gonna take a picture, before I take the picture I can see a water mark of a image that I have, and I can positionate the camera to be close to that water mark image and then I take the picture. It's like the water mark image were a mdoel to the photo.

G. Joe
  • 23
  • 1
  • 4
  • If you use Camera Intent, you will need write access to the picture file that corresponds to `onActivityResult()`. WIth custom camera app, you receive the image (normally, as a JPEG byte[]) in [Camera.PictureCallback](http://developer.android.com/intl/zh-tw/reference/android/hardware/Camera.PictureCallback.html) and you can manipulate this image to your liking. – Alex Cohn Oct 08 '15 at 13:27
  • I want to water mark the preview of the camera, not the image. But tks for the help. – G. Joe Oct 08 '15 at 16:08
  • Your edit makes the question more clear. You can overlay a view on top of the camera preview. The easiest is to show the "watermark" as a semi-transparent ImageView. – Alex Cohn Oct 08 '15 at 19:56

1 Answers1

1

Actually idk how to watermark the camera but may be the following code will help you

applyWaterMarkEffect(src, "Water mark text", 200, 200, Color.GREEN, 80, 24, false)


public Bitmap applyWaterMarkEffect(Bitmap src, String watermark, int x, int y, int 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, x, y, paint);

        return result;
    }
Mustanser Iqbal
  • 5,017
  • 4
  • 18
  • 36
  • This is not what I was looking for but your answer helped me to find the right one in this link: http://stackoverflow.com/questions/2933882/how-to-draw-an-overlay-on-a-surfaceview-used-by-camera-on-android and then I used your code to get what I was looking for. So, Thanks. – G. Joe Oct 10 '15 at 06:20