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 a JPEG file using GDI+ and then export it in Adobe Photoshop format using ImageGlue.

 

   
1
 
Drawing using GDI+    
     

We create our GDI+ Bitmap from our source image.

[Visual Basic]
Dim bm As Bitmap
bm = Bitmap.FromFile(Server.MapPath("rez/birds.jpg"))

[C#]
string path = Server.MapPath("rez/birds.jpg");
Bitmap bm = (Bitmap)Bitmap.FromFile(path);

 

   
2
 
Exporting using ImageGlue    
     

To export using ImageGlue we'll need an ImageGlue Canvas which we can obtain using the MakeCanvas function. After this it's simply a matter of saving the image in Adobe Photoshop format.

[Visual Basic]
Dim ca As Canvas
ca = ImageCopy.MakeCanvas(bm)
ca.SaveAs(Server.MapPath("birds.psd"), "")

[C#]
Canvas ca = ImageCopy.MakeCanvas(bm);
ca.SaveAs(Server.MapPath("birds.psd"), "");

 

   
3
 
Tidying Up    
     

Finally we release any memory being used by our objects.

[Visual Basic]
bm.Dispose()
ca.Clear()

[C#]
bm.Dispose();
ca.Clear();