mybmp:=tbitmap.Create ;
with mybmp do
try
loadfromfile(filelistbox1.FileName);
myjpeg:=tjpegimage.Create ;
with myjpeg do
begin
assign(mybmp);
compressionquality:=trackbar1.Position;
compress;
if savepicturedialog1.Execute then
begin
SaveToFile(savepicturedialog1.FileName+'.jpeg');
// form1.workfile := savepicturedialog1.FileName;//+'.bmp';
//SAVE1CLICK(SENDER);
//form1.ImageChage ;
end;
//savetofile('D:/delphi/FlipReverseRotate/sunflower0.jpeg');
free;
end;
finally;
free;
function Bmp2Jpg(Bmp: TBitmap; Quality: Integer = 100): TJpegImage;
begin
Result := nil;
if Assigned(Bmp)
then begin
Result := TJpegImage.Create;
Result.Assign(Bmp); {It′s all folks...}
Result.CompressionQuality := Quality;
Result.JPEGNeeded; {Key method...}
Result.Compress;
end;
end;