JPG2BMP function

zhaozj2021-02-16  62

procedure Jpg2Bmp (const source, dest: string); var MyJpeg: TJpegImage; bmp: Tbitmap; beginbmp: = tbitmap.Create; MyJpeg: = TJpegImage.Create; try myjpeg.LoadFromFile (source); bmp.Assign (myjpeg); bmp . SaveTofile (DEST); Finally Bmp.Free; myjpeg.free; end; end;

procedure TForm1.Button1Click (Sender: TObject); var BitMap: TBitmap; MyJpeg: TJpegImage; TempStream: TMemoryStream; begin TempStream: = TMemoryStream.Create; TempStream.LoadFromFile ( 'f: /eiffel.jpg'); MyJpeg: = TJpegImage. Create; BitMap: = TBitmap.Create; MyJpeg.LoadFromStream (TempStream); Bitmap.Assign (MyJpeg); Image1.Picture.Bitmap.Assign (Bitmap); TempStream.Destroy; MyJpeg.Free; Bitmap.Free; end;

转载请注明原文地址:https://www.9cbs.com/read-16323.html

New Post(0)