Saves the canvas image as a file.

 

   
Syntax
 
     

[Visual Basic]
Sub SaveAs(inFile As String, inParams As String)

[C#]
void SaveAs(string inFile, string inParams);

 

   
Params
 
     
Name   Description
inFile The path specifying the file to be saved (including file extension).
inParams A parameter string containing Image Export parameters. The Type Image Manipulation parameter.

 

   
Notes
 
     

This method saves the Canvas image to a file. The file name extension is used to find the appropriate format for the file.

You can use the Image Export parameters to control the exact output format. Using these you can exert control over a range of different options including quality, resolution (dpi), palette creation, transparency and inclusion of an alpha channel.

 

   
See Also
 
     

Canvas GetAs function.

 

   
Example
 
     

[Visual Basic]
Dim ca As New Canvas
ca.DrawFile(Server.MapPath("rez/boat.gif"), "")
ca.SaveAs(Server.MapPath("myfile1.jpg"), "")
ca.SaveAs(Server.MapPath("myfile2"), "Type=jpeg")
ca.SaveAs(Server.MapPath("myfile3.gif"), "Interlace=true")
ca.SaveAs(Server.MapPath("myfile4.gif"), "Transparent=10,10")

[C#]
Canvas ca = new Canvas();
ca.DrawFile(Server.MapPath("rez/boat.gif"), "");
ca.SaveAs(Server.MapPath("myfile1.jpg"), "");
ca.SaveAs(Server.MapPath("myfile2"), "Type=jpeg");
ca.SaveAs(Server.MapPath("myfile3.gif"), "Interlace=true");
ca.SaveAs(Server.MapPath("myfile4.gif"), "Transparent=10,10");

This code produces four files as output. The first two files ('myfile1.jpg' and 'myfile') are jpeg images. Because the second file has no file extension the type parameter is needed to specify that the image type should be jpeg.

The second two files ('myfile3.gif' and 'myfile4.gif') are both gif images. The first is interlaced and the second is transparent (using the color at the point 10,10 as the transparent color).