找出这个图片中非黑像素范围为什么总是不对
tbm:=tbitmap.Create;
tbm.LoadFromFile('1.bmp');shang:=tbm.Height+1;
you:=-1;
xia:=-1;
zuo:=tbm.Width+1;for h:=41 to tbm.Height-1 do
begin
//row:=tbm.ScanLine[h];
   for  w:=0 to tbm.Width-1 do
   begin
      if tbm.Canvas.Pixels[h,w]<>tbm.Canvas.Pixels[50,50]  then
      begin
        if w<zuo then
          zuo:=w;
        if w>you then    //找出非黑的最大最小像素
         you:=w;
        if h>xia then
          xia:=h;
        if h<shang then
          shang:=h;     end;
   end;
end;
  ShowMessage( IntToStr( shang ) + ',' + IntToStr( xia ) + ',' +
          IntToStr( zuo ) + ',' + IntToStr( you ) );