Hi,
I’m trying to save the picture captured by the camera on the SD card and cannot convert the GT.Picture picture into byte:
My code:
[
private void camera_pictureCaptured(Camera sender, GT.Picture picture)
{
GT.StorageDevice storage = sdCard.GetStorageDevice();
//save captured picture on SD card
// Picture_Captured global defined. Here byte is required. How to convert GT.Picture in bye?
Picture_Captured = new Bitmap(picture, Bitmap.BitmapImageType.Bmp);
// allocate buffer
byte[] outputFile = new byte[Picture_Captured.Width * Picture_Captured.Height * 3 + 54]; //* 3 + 54 (3 colors)
// convert to BMP file
Util.BitmapToBMPFile(Picture_Captured.GetBitmap(), Picture_Captured.Width, Picture_Captured.Height, outputFile);
string pathFileName = "\\SD\\picture_captured.bmp";
try
{
File.WriteAllBytes(pathFileName, outputFile);
Debug.Print("Saved picture_captured.bmp to file: " + pathFileName);
}
catch (Exception ex)
{
Debug.Print("Message: " + ex.Message + " Inner Exception: " + ex.InnerException);
}
}