2011-09-03 10 views

Respuesta

19

Uso Bitmap.Clone(Rectangle, PixelFormat), Aquí podemos establecer PixelFormat de la nueva imagen y el tamaño del rectángulo

// Create a Bitmap object from a file. 
Bitmap myBitmap = new Bitmap("Grapes.jpg"); 

// Clone a portion of the Bitmap object. 
Rectangle cloneRect = new Rectangle(0, 0, 100, 100); 
System.Drawing.Imaging.PixelFormat format = 
    myBitmap.PixelFormat; 
Bitmap cloneBitmap = myBitmap.Clone(cloneRect, format); 

// Draw the cloned portion of the Bitmap object. 
e.Graphics.DrawImage(cloneBitmap, 0, 0); 
+0

¿Qué es este PixelFormat para? – Bosak

+0

podemos especificar un nuevo formato de píxel de imagen – Damith

Cuestiones relacionadas