|
[Visual Basic]
Dim ca As New Canvas
Dim inpath, outpath As String
inpath = Server.MapPath("rez/layers.psd")
outpath = Server.MapPath("drawfile.jpg")
ca.Color = System.Drawing.Color.Yellow
ca.Width = 200
ca.Height = 200
ca.DrawFile(inpath, "Image=4 Mode=transparent")
ca.SaveAs(outpath, "Quality=high")
[C#]
Canvas ca = new Canvas();
string inpath = Server.MapPath("rez/layers.psd");
string outpath = Server.MapPath("drawfile.jpg");
ca.Color = System.Drawing.Color.Yellow;
ca.Width = 200;
ca.Height = 200;
ca.DrawFile(inpath, "Image=4 Mode=transparent");
ca.SaveAs(outpath, "Quality=high");
The code looks for a Photoshop file called 'layers.psd'. It pulls
out the fourth image (there is one composite image and three layers
in the file) and draws it transparent onto a yellow background.
Finally it saves out the image as a jpeg. The input and output is
shown below.
layers.psd
drawfile.jpg
|