jpg转换成bmp:
uses jpeg;
var
jpg :TJPEGImage;
bmp :TBitmap;
begin
//jpg转换成bmp
jpg := TJPEGImage.Create;
bmp := TBitMap.Create;
try
jpg.LoadFromFile('sign.jpg');
bmp.Assign(jpg);
bmp.SaveToFile('sign_data.bmp');
finally
bmp.FreeImage;
bmp.Free;
jpg.Free;
end;
//bmp保存到数据库(字段类型为image)
with cdsPatientConfirm do
begin
Append;
TBlobField(FieldByName('sign_data')).
LoadFromFile(ExtractFiledir(Application.exeName)+'\sign_data.bmp');
Post;
if ApplyUpdates(0) <> 0 then
begin
ShowMessage('签名数据保存失败!');
Exit;
end;
end;
end;
gif转换成bmp:
uses GIFImage;
var
gif: TGIFImage;
bmp :TBitmap;
begin
//gif转换成bmp
gif := TGIFImage.Create;
bmp := TBitMap.Create;
try
gif.LoadFromFile('sign.gif');
bmp.Assign(gif);
bmp.SaveToFile(ExtractFiledir(Application.exeName)+'\sign_data.bmp');
finally
bmp.FreeImage;
bmp.Free;
gif.Free;
end;
//bmp保存到数据库(字段类型为image)
with cdsPatientConfirm do
begin
Append;
TBlobField(FieldByName('sign_data')).
LoadFromFile(ExtractFiledir(Application.exeName)+'\sign_data.bmp');
Post;
if ApplyUpdates(0) <> 0 then
begin
ShowMessage('签名数据保存失败!');
Exit;
end;
end;
end;