Reputation: 194
I use Firemonkey XE5 to take picture and save to device. I use standard action TakePhotoFromCameraAction
and on DidFinishTaking get TBitmap
. That's OK, but when I try to store this picture using
ImageContainer.Bitmap.SaveToFile(System.IOUtils.TPath.GetDocumentsPath + System.SysUtils.PathDelim + 'myfile.bmp');
Nothing happens. Image is not stored, but application seems to be running - I can take another picture.
How to solve this?
Upvotes: 3
Views: 4736
Reputation: 11
I had similar Problems, however, it was not a Problem of saving. My Problem was actually that the device was connected to my Computer through usb. I opend the device in the file Explorer and I would not be able to see the Pictures I just saved. I then disconnected the device and connected it again, opening a new file Explorer and there they where....
Upvotes: 1
Reputation: 333
I had the same problem before. After tracing SaveToFile function in FMX.Graphix.TBitmap.SaveToFile, then to FMX.Graphix.TBitmapCodecManager.SaveToFile function, I found that this function return False because:
if SameText(ExtractFileExt(AFileName), Descriptor.Extension, loUserLocale) and Descriptor.CanSave then
the if condition return False because the Descriptor.Extension is '.jpg' not '.bmp'.
So the solution is to use '.jpg' extension for the file or to use SaveParams (Default = nil) parameter in SaveToFile function to match the bmp type.
Upvotes: 1