Save image from TImage to filesystem [Android] |
|
I'd like to save image from TImage to filesystem on Android:
procedure TForm1.btnSaveEvidenceClick(Sender: TObject);
var
FileName : String;
BMP : TBitmap;
begin
FileName := TPath.Combine(TPath.GetPicturesPath, 'File');
ShowMessage(FileName);
BMP.Create;
BMP.CopyFromBitmap(imgBarcodePhoto.Bitmap);
BMP.Assign(imgBarcodePhoto.Bitmap);
BMP.SaveToFile(FileName);
end;
Both CopyFromBitmap, and Assign gives me Access Violation...
imgBarcodePhoto is taken with camera and is visible.
|
Re: Save image from TImage to filesystem [Android] [Edit] |
|
I changed the procedure:
procedure TForm1.btnSaveEvidenceClick(Sender: TObject);
var
FileName : String;
BMP : TBitmap;
begin
FileName := TPath.Combine(TPath.GetPicturesPath, 'File.bmp');
ShowMessage(FileName);
BMP := TBitmap.Create;
//BMP.CopyFromBitmap(imgBarcodePhoto.Bitmap);
BMP.Assign(imgBarcodePhoto.Bitmap);
Image1.Bitmap.Assign(BMP);
BMP.SaveToFile(FileName);
end;
What is fastinating Image1 is updated with BMP bitmap :-)
I have "Write external storage" True
When I use Assign() then ReWrite with the same TPath it saves the file to Pictrues folder... it looks like SaveToFile from TBitmap doesn't work well...
When I use string 'File.png' instead of 'File.bmp' it works perfect ;)
How can I pass it to have bmp?
Edited by: Sebastian Kozub on Mar 12, 2014 4:51 AM
|
Re: Save image from TImage to filesystem [Android] |
|
Re: Save image from TImage to filesystem [Android] |
|