CSDN博客

img Delphinus

压缩图像文件并转换成BMP格式

发表于2004/1/25 21:18:00  942人阅读

分类: delphi

function GraphicToBmp(P: TPicture; Quality: Integer = 80): TBitmap;
var
  Jpg: TJpegImage;
begin
  Result := TBitmap.Create;
  with Result do
  begin
    Width := P.Width;
    Height := P.Height;
    Canvas.Draw(0, 0, P.Graphic);
  end;
  if Assigned(Result) then
  begin
    Jpg := TJpegImage.Create;
    Jpg.Assign(Result);
    Jpg.CompressionQuality := Quality;
    Jpg.JPEGNeeded;
    Jpg.Compress;
    if Assigned(Jpg) then
    begin
      Jpg.DIBNeeded;
      Result.Assign(Jpg);
    end;
  end;
end;
0 0

相关博文

我的热门文章

img
取 消
img