Monday, 25 May 2015

How to create Bitmap image and store to sdcard xamarin.forms android?

Bitmap bitmap = Control.DrawingCache;
            Canvas canvas = new Canvas(bitmap);
            ImageView image = new ImageView(Control.Context);
            Java.IO.File file = Android.OS.Environment.ExternalStorageDirectory;
            //Captured chart image
            image.SetImageBitmap(bitmap);
var path = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;

path = System.IO.Path.Combine(path, e.Name);      
FileStream fos = new FileStream(path, FileMode.CreateNew);

            bitmap.Compress(Bitmap.CompressFormat.Png, 100, fos);

No comments:

Post a Comment