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

This example shows how to draw import an Adobe Photoshop file using Imageglue and then export it in JPEG format using System.Drawing.

1
Drawing using ImageGlue

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

[C#]

using (Image bm = Bitmap.FromFile(Server.MapPath("rez/layers2.psd"))) {


2
Exporting using System.Drawing

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

[C#]

  using (System.Drawing.Bitmap img = Bitmap.ToSystemDrawingBitmap((Bitmap)bm)) {
    var format = System.Drawing.Imaging.ImageFormat.Jpeg;
    img.Save(Server.MapPath("ImageGlue_Import_NET_9.jpg"), format);
  }
}


3
Input and Output

Sample input and output images are shown below.


rez/layers2.psd


ImageGlue_Import_NET_9.jpg