var
MyJpeg: TJpegImage;
Image1: TImage;
begin
Image1:= TImage.Create(self);
MyJpeg:= TJpegImage.Create;
Image1.Picture.Bitmap.LoadFromFile('c:/windows/desktop/aa.BMP'); // Load the Bitmap from a file
MyJpeg.Assign(Image1.Picture.Bitmap); // Assign the BitMap to MyJpeg object
MyJpeg.CompressionQuality:=StrToInt('75');
MyJpeg.Compress;
MyJpeg.SaveToFile('c:/windows/desktop/test.JPG'); // Save the JPEG to Disk
end;