Solución... (perdí tanto tiempo tratando de hacer esto y ahora que lo hice lo veo tan fácil, hay días que no le acierto un tiro al mundo aunque este hinchado....




)
Código Delphi
[-]
procedure TFSectorVisualizar.asignarImagen(inY, finY : Integer);
var
x,y, x1, y1, xIni, yIni : Integer;
BitMap : TBitMap;
P : PByteArray;
lColor : TColor;
rectanOrigen : TRect;
begin
try
x1 := 0;
y1 := 0;
xIni := ImagenOrigen.Width;
yIni := ImagenOrigen.Height;
Bitmap := TBitmap.Create;
Bitmap.Width:= ImagenOrigen.Width;
Bitmap.Height:= ImagenOrigen.Height;
Bitmap.Canvas.Draw(0,0,ImagenOrigen.Picture.Graphic);
for y := inY to FinY do
begin
for x := 0 to BitMap.Width -1 do
begin
if BitMap.Canvas.Pixels[x,y] = clblack then
begin
if x > x1 then
x1 := x;
if y > y1 then
y1 := y;
if x < xIni then
xIni := x;
if y < yIni then
yIni := y;
end;
end;
end;
if (x1 > xIni) and (y1 > YIni) then
begin
imDestino.Width := x1 - xIni;
imDestino.Height := y1 - yIni;
rectanOrigen := rect(xIni, yIni, x1, y1);
imDestino.Canvas.CopyRect(Rect(0,0, x1 - xIni, y1 - yIni),BitMap.Canvas,rectanOrigen);
end;
finally
end;
end;