Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   Recortar Imagen (https://www.clubdelphi.com/foros/showthread.php?t=25483)

fmtidona 23-09-2005 18:45:46

Recortar Imagen
 
De forma casera, hago........

bitmap.Width := BitMap.Width - constanteA;
bitmap.Height := BitMap.Height - constanteB;

con esto logro recortar la base y el costado derecho, solo me falta recortar el lateral izquierdo y la parte superior.


estuve viendo la instruccion CopyRect(), que aparentemente me solucionaria el problema, pero no la pude hacer andar y no hay mucha ayuda.

gracias

dec 24-09-2005 00:13:36

Hola,

¿Viste ya el ejemplo que se proporciona en la ayuda de Delphi para el método "CopyRect" de "TCanvas"?

Cita:

Empezado por Ayuda de Delphi
The following code illustrates the differences between CopyRect and BrushCopy. The bitmap graphic ‘TARTAN.BMP’ is loaded into Bitmap and displayed on the Canvas of Form1. BrushCopy replaces the color black in the graphic with the brush of the canvas, while CopyRect leaves the colors intact.

Código Delphi [-]
 var
    Bitmap: TBitmap;
    MyRect, MyOther: TRect;
  begin
    MyRect := Rect(10,10,100,100);
    MyOther := Rect(10,111,100, 201);
    Bitmap := TBitmap.Create;
    Bitmap.LoadFromFile('c:\windows\tartan.bmp');
    Form1.Canvas.BrushCopy(MyRect, Bitmap, MyRect, clBlack);
    Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
    Bitmap.Free;
  end;


fmtidona 26-09-2005 19:18:20

Muchas gracias, logre recortar la foto, pero al grabarla me graba la foto original y no la parte que recorte
var
Bitmap: TBitmap;
MyRect, MyOther: TRect;
begin
MyRect := Rect(10,10,100,100);
MyOther := Rect(10,111,100, 201);
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('c:\windows\tartan.bmp');
Form1.Canvas.BrushCopy(MyRect, Bitmap, MyRect, clBlack);
Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
bitmap.SaveToFile('c:\windows\tartan.bmp'); Bitmap.Free;
end;


La franja horaria es GMT +2. Ahora son las 20:21:25.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi