Create an image from a System.Drawing bitmap.
Syntax

[C#]

static XImage FromBitmap(Bitmap inBitmap);

[Visual Basic]

Shared Function FromBitmap(inBitmap As Bitmap) As XImage
Notes

Use this method to import a System.Drawing bitmap into an XImage that can be drawn on a Canvas.

Example

Here we create a Bitmap and draw a JPEG file into it using GDI+. We then copy the Bitmap into an XImage and export it as an Adobe Photoshop file.

[C#]Bitmap bitmap = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/birds.jpg"));
Canvas canvas = new Canvas(XImage.FromBitmap(bitmap));
canvas.SaveAs(Server.MapPath("birds.psd"));


[Visual Basic]Dim bitmap__1 As Bitmap = DirectCast(Bitmap.FromFile(Server.MapPath("rez/birds.jpg")), Bitmap)
Dim canvas As New Canvas(XImage.FromBitmap(bitmap__1))
canvas.SaveAs(Server.MapPath("birds.psd"))