Firemonkey: Loading a JPEG into any type of image control then saving to file or stream makes it smaller. Can this be avoided?

  

In a mobile app one or more images (only jpeg/jpg) – either taken with built-in camera or selected from photo library – are displayed before uploading to a web service.

But loading an image into a FMX TImage / TImageControl / TImageViewer and saving it to stream (or file) makes it smaller, about 45%.

Any idea why this happens and is there a way to avoid the reduction in size ?

As asked for this is the simple test code, nothing special to it:

procedure TImageTest.btnTestClick(Sender: TObject);
var
aFile : string;
begin
if not OpenDialog.Execute then
Exit;
// get jpg file name for loading
aFile := OpenDialog.Filename;
// load into TImage, TImageControl or TImageViewer
ImageViewer.Bitmap.LoadFromFile(aFile);
// and save to file for comparison
ImageViewer.Bitmap.SaveToFile(aFile+’_2.jpg’);
end;

Comments are closed.