function Bmp2Jpg(Bmp: TBitmap; Quality: Integer = 100): TJpegImage; begin Result := nil; if Assigned(Bmp) then begin Result := TJpegImage.Create; Result.Assign(Bmp); {Its all folks...} Result.CompressionQuality := Quality; Result.JPEGNeeded; {Key method...} Result.Compress; end;end; function Jpg2Bmp(Jpg: TJpegImage): TBitmap; begin Result := nil; if Assigned(Jpg) then begin Result := TBitmap.Create; Jpg.DIBNeeded; {Key method...} Result.Assign(Jpg); {Its all folks...} end; end;
解决方案 »
- EXE主窗体改变尺寸时,窗体中的Panel也会跟着变(Panel.Align设为了alClient),但其中嵌入的DLL窗体不会跟着变
- 谁有在delphi7环境下发送和接受电子邮件的原代码?*(最好是带附件发送的)谢谢!
- 当一个日期型字段(adate)的值为空时,用以下语句fieldbyname('adate').asdatetime得出的值是多少呀
- MSN插件的问题
- 求助!
- SOS!面试的问题
- 请给我一篇文章:编写 dll 的例子。 谢!
- 各位高手,救救我吧!!!!!1
- 有没有显示图片特效的软件
- 为何用菜单可以实现而用快捷按钮却终止程序?还有同一个按钮用鼠标点击可以而敲回车却不灵(终断)?急!!!!
- 我是熟练的Delphi程序员,有硕士学位,想在北京找一份兼职。
- 在delphi中用recordset.append命令给数据库增加一条新记录,如何让新记录默认为上一记录的内容?
//转换JPG到BMP格式**************************************************************
//==============================================================================
procedure JPG2BMP(const Source, Target:string);
var JPG: TJpegImage;
BMP: TBitmap;
begin
BMP := TBitmap.Create;
JPG := TJpegImage.Create;
try
JPG.LoadFromFile(Source);
BMP.Assign(JPG);
BMP.SaveToFile(Target);
finally
BMP.free;
JPG.Free;
end;
end;//==============================================================================
//转换BMP到JPG格式**************************************************************
//==============================================================================
procedure BMP2JPG(const Source, Target:string; const Scale: Byte);
var Image: TImage;
JPG: TJpegImage;
begin
Image := TImage.Create(Application);
JPG := TJpegImage.Create;
try
Image.Picture.Bitmap.LoadFromFile(Source);
JPG.Assign(Image.Picture.Bitmap);
JPG.CompressionQuality := Scale;
JPG.Compress;
JPG.SaveToFile(Target);
finally
Image.free;
JPG.Free;
end;
end;