Graphics.DrawImage Method (Bitmap, Rectangle, Rectangle, CombineMode, Single, ResizeInterpolationMode)

Draws the specified portion of the specified Bitmap at the specified location and with the specified size.

Namespace: Aurigma.GraphicsMill.Drawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)


public void DrawImage(
	Bitmap bitmap,
	Rectangle dstRect,
	Rectangle srcRect,
	CombineMode combine,
	float opacity,
	ResizeInterpolationMode interpolationMode



Type: Aurigma.GraphicsMill.Bitmap

The Bitmap to draw.

Type: System.Drawing.Rectangle

A Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.

Type: System.Drawing.Rectangle

A Rectangle structure that specifies the portion of the image object to draw.

Type: Aurigma.GraphicsMill.Transforms.CombineMode

The image blending algorithm (plain pixels copying, alpha blending, bitwise operations, etc.).

Type: System.Single

The opacity of the image in range [0, 1]. If 0, image is completely transparent, if 1, image is completely opaque.

Type: Aurigma.GraphicsMill.Transforms.ResizeInterpolationMode

The resize algorithm. Using this parameter you can select between speed and quality of resizing.


The Bitmap is drawn to destination rectangle on this Graphics. If the current bitmap dimensions differ from dimensions of the destination rectangle, it is resized to have the same size as the destination rectangle.


If the bitmap has pixel format which is not GDI-compatible (e.g. extended pixel formats, CMYK, etc) method will automatically create a copy converted to the Format32bppArgb. That's why you always get it drawn, but if you are going to call this method multiple times, it is recommended to convert the bitmap to some GDI-compatible format (like Format32bppArgb) to increase the performance.

If you want this method to calculate width and height automatically, you can pass 0 to the corresponding arguments. The dimensions will be calculated with the following way:

  1. If both width and heigth are 0, it will take source image dimensions (Width and Height properties). This way the image will not be resized during drawing.
  2. If only one of arguments is 0, it will calculate this argument to save proportion. For example, the source image is 800x600, and you pass 400 as width and 0 as height. Height will be calculated to preserve aspect ratio of the image, i.e. it will be 300.

See Also