打印本文 打印本文 关闭窗口 关闭窗口
压缩图像文件并转换成BMP格式
作者:武汉SEO闵涛  文章来源:敏韬网  点击数940  更新时间:2009/4/23 18:35:37  文章录入:mintao  责任编辑:mintao
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;

打印本文 打印本文 关闭窗口 关闭窗口