unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,jpeg, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
BKImg: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure DrawMap(Backgroud,InsertMap: String);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.DrawMap(Backgroud,InsertMap: String);
var JPEG: TJPEGImage;
bmp: TBitmap;
begin
bmp := TBitmap.Create;
if Uppercase(ExtractFileExt(Backgroud)) = '.JPG' then begin
JPEG:= TJPEGImage.Create;
JPEG.LoadFromFile(Backgroud);
bmp.Assign(JPEG);
JPEG.Free;
end else if Uppercase(ExtractFileExt(Backgroud)) = '.BMP' then begin
bmp.LoadFromFile(Backgroud);
end;
BKImg.Picture.Bitmap:= bmp;
if Uppercase(ExtractFileExt(InsertMap)) = '.JPG' then begin
JPEG:= TJPEGImage.Create;
JPEG.LoadFromFile(InsertMap);
bmp.Assign(JPEG);
JPEG.Free;
end else if Uppercase(ExtractFileExt(InsertMap)) = '.BMP' then begin
bmp.LoadFromFile(InsertMap);
end;
BKImg.Canvas.Draw(0, 0, bmp);
BKImg.Picture.SaveToFile('D:/合成图.bmp');
bmp.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DrawMap('d:/2005917105527.jpg','d:/肖像6.bmp');
end;
end.
给你做一个JPG图像和BMP图像合成的例子吧,别的更复杂的功能还请自己研究。