如果??
我试过image1.canvas.pixel但只能用于bmpGetPixel(getdc(image1.canvas.Handle,x,y) 也不行
谢谢大虾,图片只能是jpg
关于放大缩小有没有其它好的办法。只用过image1.trunc(image1.Height * 放大缩小系数))
我试过image1.canvas.pixel但只能用于bmpGetPixel(getdc(image1.canvas.Handle,x,y) 也不行
谢谢大虾,图片只能是jpg
关于放大缩小有没有其它好的办法。只用过image1.trunc(image1.Height * 放大缩小系数))
或者使用ImageEn图形控件。
gz
(*压缩MBP为JPEG;但是没有提供压缩比可选项
凑合用吧,大概1/3 ^_^:
Note:必须加上JPEG到Uses单元
*)
var
MyJPEG : TJPEGImage;
MyBMP : TBitmap;
begin
MyBMP := TBitmap.Create;
with MyBMP do
try
LoadFromFile('e:\lm.BMP'); //你的图片位置
MyJPEG := TJPEGImage.Create;
with MyJPEG do begin
Assign(MyBMP);
CompressionQuality:=10; //压缩比例
Compress;
SaveToFile('e:\lm01.JPEG');//保存路径……
Free;
end;
finally
Free;
end;
end;--------------------------------------------------------------------------------
By Luiz Vaz - [email protected] 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; 注意:JPEGNeeded过程转换并存储图像数据到内部的JPEG数据。我们无法直接存取JPEG 内部数据,因为D5并没有提供jpeg.pas单元的源码。但是可以通过JPEGNeeded和DIBNeeded过程来操作它。