'');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
image1.picture.icon.loadfromfile(''c:\myicon.ico'');
end;
end.
==================================================================
3. Chinese:转换BMP->JPEG文件格式
Englsh:convert the bitmap into a JPEG file format
------------------------------------------------------------------
var
MyJpeg: TJpegImage;
Image1: TImage;
begin
Image1:= TImage.Create;
MyJpeg:= TJpegImage.Create;
Image1.LoadFromFile(''TestImage.BMP''); // 读取Bitmap文件
MyJpeg.Assign(Image1.Picture.Bitmap);
object
MyJpeg.SaveToFile(''MyJPEGImage.JPG''); //保存JPEG
end;
--------------------------------------------------------------------
4.JPEG 转换为BMP函数
procedure Jpg2Bmp(const source,dest:string);
var
MyJpeg: TJpegImage;
bmp: Tbitmap;
begin
bmp:=tbitmap.Create;
MyJpeg:= TJpegImage.Create;
try
myjpeg.LoadFromFile(source);
bmp.Assign(myjpeg);
bmp.SaveToFile(dest);
finally
bmp.free;
myjpeg.Free;
end;
end;
----------------------------------------------------------
5.Bmp转换为JPEG文件格式函数
----------------------------------------------------------
procedure Bmp2Jpg(const source,dest:string;const scale:byte);
var
MyJpeg: TJpegImage;
Image1: TImage;
begin
Image1:= TImage.Create(application);
MyJpeg:= TJpegImage.Create;
try
Image1.Picture.Bitmap.LoadFromFile(source);
MyJpeg.Assign(Image1.Picture.Bitmap);
MyJpeg.CompressionQuality:=scale;
MyJpeg.Compress;
MyJpeg.SaveToFile(dest);
finally
image1.free;
myjpeg.Free;
end;
end;
-----------------------------------------------------------------------