Hi,
I useing Camera2basic.
I take picture in two format. Orignal And Timestamp Watermark.
When I take a orignal photo auto-rotation work correctly, but when I write date and time on photo auto-rotation not working for me.
my code :
public void Run()
{
ByteBuffer buffer = mImage.GetPlanes()[0].Buffer;
byte[] bytes = new byte[buffer.Remaining()];
buffer.Get(bytes);
using (var output = new FileOutputStream(mFile))
{
try
{
#region WatermarkeOnPhoto
if (AppInfo.PrintTimeStamp)
{
Android.Graphics.Bitmap OrignalImage;
Android.Graphics.Bitmap WatermarkedImage;
OrignalImage = BitmapFactory.DecodeByteArray(bytes, 0, bytes.Length); // Load your bitmap here
bytes = null;
WatermarkedImage = OrignalImage.Copy(Android.Graphics.Bitmap.Config.Argb8888, true);
Canvas canvas = new Canvas(WatermarkedImage);
Paint paint = new Paint();
paint.Color = Android.Graphics.Color.Orange;
paint.TextSize = 50;
canvas.DrawText("Some", 50, 50, paint);
using (var stream = new System.IO.MemoryStream())
{
WatermarkedImage.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
bytes = stream.ToArray();
}
}
#endregion WatermarkeOnPhoto
output.Write(bytes);
}
catch (IOException e)
{
e.PrintStackTrace();
}
finally
{
mImage.Close();
}
}
}
[2]: /answers/storage/attachments/80264-home-staging-worth-it-1024x576.jpg