压缩图像文件并转换成BMP格式
敬业的IT人
互联网
佚名
2008-1-4 16:20:05
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;
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;
- 最新文章
- 开发一个基于DCOM的局域网聊天室(二)[01-04]
- 隐藏我的电脑中驱动器[01-04]
- Delphi中的四舍五入问题[01-04]
- 打造Delphi中字符串的replace函数[01-04]
- NeHe的opengl教程delphi版(4)----旋转[01-04]
- TListView组件使用方法[01-04]
- 相关文章
