The images the camera is taking are 324 x 190. How can I take larger photos using android intent? Current code:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
StartActivityForResult(intent, 0);
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (resultCode == Result.Ok && requestCode == 0)
{
var settings = PreferenceManager.GetDefaultSharedPreferences(this);
var assetID = settings.GetString("unit", null);
var store = settings.GetString("store", null);
DateTime dt = DateTime.Now;
var date1 = dt.ToString("MM-dd-yyyy");
var time1 = dt.ToString("HH:mm");
Bitmap bitmap = (Android.Graphics.Bitmap)data.Extras.Get("data");
using (var stream = new System.IO.MemoryStream())
{
bitmap.Compress(Android.Graphics.Bitmap.CompressFormat.Png, 0, stream);
byte[] imageBytes = stream.ToArray();
string base64String = Convert.ToBase64String(imageBytes);
inst.saveImage(base64String, store, assetID, date1, time1);
}
}
}
inst.saveImage… is a Web Method that saves the image to a SQL Server Database.
Then when I run a select on that table to display the image in a browser in my ASP.net project using
"data:image/png;base64," + base64 string from SQL,
it is only a 324 x 190 image. I need either for it to take a larger photo from the intent or a way to display it larger using the data url in ASP.net.
To get a full size image from the IMAGE_CAPTURE intent, you need to use:
Something like this:
http://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE