Android Question CameraEx - insert date\time in the image

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hi all
how can I insert the date and time in the image displayed by CameraEx and save it together with the image itself?

thank in advance
 
You can use code like this:
Code: Copy
camEx.SavePictureToFile(Data, PicDir, PicFilename)

Dim CVS As Canvas
Dim IV As ImageView

IV.Bitmap = LoadBitmap(PicDir,PicFilename)
IV.Visible = True

CVS.Initialize(IV)
CVS.DrawText("This is the date", 11dip,21dip,Typeface.DEFAULT,14,Colors.Black,"LEFT")
CVS.DrawText("This is the date", 10dip,20dip,Typeface.DEFAULT,14,Colors.Yellow,"LEFT")

Dim Out As OutputStream
Out = File.OpenOutput(PicDir, PicFilename, False)
CVS.Bitmap.WriteToStream(Out, 90, "JPEG")
Out.Close

The above code first draws the text in color black on the image, then redraws the text again slightly offset on top of it in yellow to create a drop-shadow effect to make the text readable regardless of the colors in the image under the text.
 
Last edited:
Upvote 0
Hi,
If you want to save it without displaying it - search the forum for Exif.

If you want to save it on the image itself - search for Canvas

This should point you in the right direction.
 
Upvote 0
Back
Top