GDI+ supports a limited range of input file formats. You may wish to combine the import and export facilities of ImageGlue with those of GDI+ for a more comprehensive approach to drawing images.

This example shows how to draw an Adobe Photoshop file using ImageGlue and then export it as a JPG using GDI+.

1
Drawing using ImageGlue

We create our ImageGlue canvas and draw our image onto it.

[C#] Canvas canvas = new Canvas(Server.MapPath("rez/layers.psd"));


[Visual Basic] Dim canvas As New Canvas(Server.MapPath("rez/layers.psd"))


2
Exporting using GDI+

To export using GDI+ we'll need a GDI+ Bitmap which we can obtain using the ToBitmap function. After this it's simply a matter of exporting the image as a JPG.

[C#] Bitmap bitmap = canvas.ToBitmap(".jpg");
bitmap.Save(Server.MapPath("ImageGlue_Import_NET_9.jpg"), ImageFormat.Jpeg);


[Visual Basic] Dim bitmap As Bitmap
bitmap = canvas.ToBitmap(".jpg")
bitmap.Save(Server.MapPath("ImageGlue_Import_NET_9.jpg"), ImageFormat.Jpeg)


3
Tidying Up

Finally we release any memory being used by our objects.

[C#] bitmap.Dispose();
canvas.Clear();


[Visual Basic] bitmap.Dispose()
canvas.Clear()


4
Input and Output

Sample input and output images are shown below.


rez/layers.psd


ImageGlue_Import_NET_9.jpg