美高梅网址注册-澳门mgm4858集团登录网址
做最好的网站
来自 澳门mgm4858集团登录网址 2020-01-04 23:12 的文章
当前位置: 美高梅网址注册 > 澳门mgm4858集团登录网址 > 正文

图片完整路径澳门mgm4858集团登录网址 PressQualit

添加引用:uses JPEG;
//=====================图片处理函数,将覆盖原图片文件===========================
//=====filename:图片完整路径 PressQuality:压缩质量 Width:宽 Height:高
function CompressMainFun(filename: String; PressQuality,Width,Height:integer): Boolean;
var
bmp: TBitmap;
jpg: TJpegImage;
i: Integer;
sTemp:string;
begin
Result := False;
if pos(UpperCase('.bmp'), UpperCase(filename)) <> 0 then //bmp格式
begin
bmp.LoadFromFile(filename);
jpg.Assign(bmp);
jpg.CompressionQuality := PressQuality;
jpg.Compress;
bmp.height := Height;
bmp.Width := Width;
bmp.Canvas.StretchDraw(bmp.Canvas.ClipRect, jpg);
jpg.Assign(bmp);
sTemp := filename + '.jpg';
jpg.SaveToFile(sTemp);
DeleteFile(filename);
CopyFile(PChar(sTemp), PChar(filename), True);
DeleteFile(sTemp);
end
else //其它格式
begin
jpg.LoadFromFile(filename);
bmp.height := Height;
bmp.Width := Width;
bmp.Canvas.StretchDraw(bmp.Canvas.ClipRect, jpg);
jpg.Assign(bmp);
jpg.CompressionQuality := PressQuality;
jpg.Compress;
sTemp := filename + '.jpg';
jpg.SaveToFile(sTemp);
DeleteFile(filename);
CopyFile(PChar(sTemp), PChar(filename), True);
DeleteFile(sTemp);
end;
Result := True;
end;

uses jpeg;

procedure ZipJPEG;
var
  jpg: TJpegImage;
  bmp: TBitmap;
begin
  jpg := TJpegImage.Create;
  bmp := TBitmap.Create;
  try
    jpg.LoadFromFile('c:A.jpg',',',');

本文由美高梅网址注册发布于澳门mgm4858集团登录网址,转载请注明出处:图片完整路径澳门mgm4858集团登录网址 PressQualit

关键词: