求助各位大侠:
兄弟现在自己做了一个小的拷屏程序,可以将屏幕copy 到image 中,但是在将image 保存为 gif 文件时候,有些区域会变色(比如delphi 的灰色边框,保存以后用画图程序打开,就编程黄色的了。),有些区域会保持正常。
我google 了一下,gif 不是号称无损压缩的吗? 为什么会这样呢? 请大侠帮忙
兄弟现在自己做了一个小的拷屏程序,可以将屏幕copy 到image 中,但是在将image 保存为 gif 文件时候,有些区域会变色(比如delphi 的灰色边框,保存以后用画图程序打开,就编程黄色的了。),有些区域会保持正常。
我google 了一下,gif 不是号称无损压缩的吗? 为什么会这样呢? 请大侠帮忙
procedure TForm1.btn1Click(Sender: TObject);
var w,h,x,y:integer;
p:pbytearray;
fiestr:string;
src:TBitmap;
begin
src:=TBitmap.Create;
src:=img1.Picture.Bitmap;
w:=src.width;
h:=src.height;
src.PixelFormat :=pf24bit; //像素模式
for y:=0 to h-1 do begin
p:=src.scanline[y]; //取得一行象素点
for x:=0 to w-1 do begin
//pf24bit的图像每个像素用3个字节表示
p[x*3]:= not p[x*3];
p[x*3+1]:= not p[x*3+1];
p[x*3+2]:= not p[x*3+2];
end;
end;
img2.Picture.Bitmap:=src;
end;