How can I convert a BMP file to a JPG file? How can I convert it to a JPG file in Delphi?
Answer questions from netizens:
========================================================== =========================================> 〉
: How can I convert a BMP file to a JPG file? How can I convert it to a JPG file in Delphi?
: JPG file?
:
<======================================================== ======================================
This user, if you use delphi4, notices that its timage supports the format of *. jpg, *. JPEG, *. BMP, *. ICO ...... This problem will be well solved!
The source code is as follows:
<<
Procedure tform1.button1click (Sender: tobject );
(* Compression of BNS is JPEG, but the compression ratio is not available.
Try it out. About 1/3 ^ _ ^:
Note: JPEG to uses must be added.
*)
VaR
Myjpeg: tsf-image;
Mybmp: tbitmap;
Begin
Mybmp: = tbitmap. Create;
With mybmp do
Try
Loadfromfile ('e:/lm. BMP '); // your image location
Myjpeg: = tsf-image. Create;
With myjpeg do begin
Assign (mybmp );
Compressionquality: = 10; // compression ratio
Compress;
Savetofile ('e:/lm01.jpeg '); // save path ......
Free;
End;
Finally
Free;
End;
End;