hi guys,
how can stamp some text into a picture taken from camEx without changing the original picture DPI, resolution, zoom etc., actually leave the picture as it is
i tried the two following approaches without real success
pictures are reduced to 50% JPG quality due to upload limit
how can stamp some text into a picture taken from camEx without changing the original picture DPI, resolution, zoom etc., actually leave the picture as it is
i tried the two following approaches without real success
B4X:
Sub Camera1_PictureTaken (Data() As Byte)
' save the original picture'
' picture 1.jpg'
camEx.SavePictureToFile(Data, rp.GetSafeDirDefaultExternal(""), "1.jpg")
'############################################################################################################################################
'does not deal with aspect ratio correctly (canvas.Initialize), or i am using it not correct'
'picture out.jpg
ImageView1.Bitmap = BytesToBitmap(Data)
canvas.Initialize(ImageView1) ' canvas has the wrong x,y resolution now how, to resize for picture size
canvas.DrawText("some text", ImageView1.Width/2 , ImageView1.Height - 20dip ,Typeface.DEFAULT , 15, Colors.Blue, "CENTER")
'ImageView1.Invalidate
b = ImageView1.Bitmap
Dim out As OutputStream
out = File.OpenOutput(rp.GetSafeDirDefaultExternal(""), "out.jpg", False)
b.WriteToStream(out, 100, "JPEG")
out.Close
'############################################################################################################################################
'RSImageEffects 'zooms' somehow into the picture
'picture out1.jpg
Dim BitmapTemp As Bitmap
BitmapTemp.Initialize3(BytesToBitmap(Data))
BitmapTemp = rs.Watermark(BitmapTemp,"some text",BitmapTemp.Width/2 , BitmapTemp.Height - 20dip,Colors.red,255,80,False)
Dim out As OutputStream
out = File.OpenOutput(rp.GetSafeDirDefaultExternal(""), "out1.jpg", False)
BitmapTemp.WriteToStream(out, 100, "JPEG")
out.Close
'############################################################################################################################################
camEx.StartPreview 'restart preview
End Sub
pictures are reduced to 50% JPG quality due to upload limit