This documentation is for the old version. Go to the latest Graphics Mill docs

Bitmap.Save Method (Stream, IEncoderOptions)

Saves the bitmap into specified Stream.

Namespace: Aurigma.GraphicsMill
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public Sub Save ( _
	stream As Stream, _
	options As IEncoderOptions _
)
C#
public void Save(
	Stream stream,
	IEncoderOptions options
)

Parameters

stream

Type: System.IO.Stream

The target Stream.
options

Type: Aurigma.GraphicsMill.Codecs.IEncoderOptions

An object containing encoder settings.

Remarks

Using this method is the same as creating appropriate writer derived from FormatWriter and running it in synchronous mode.

Examples

Visual Basic
<%@ Page Language="vb" AutoEventWireup="True"%>
<%@ Import Namespace="Aurigma.GraphicsMill"%>
<%@ Import Namespace="Aurigma.GraphicsMill.Codecs"%>
<%@ Import Namespace="Aurigma.GraphicsMill.Transforms"%>
<script language="vb" runat="server">
'#Region pageload
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
	Dim bitmap As New Bitmap(Server.MapPath("SourceImages/Mountain.jpg"))
	
	'Resize to 100 pixels width
	bitmap.Transforms.Resize(100, 0, InterpolationMode.MediumQuality)

	'Save image to response stream
	Response.Clear()	
	bitmap.Save(Response.OutputStream, New JpegEncoderOptions(70, true))
	Response.End()
End Sub
'#End Region
</script>
C#
<%@ Page Language="c#" AutoEventWireup="True" %>
<%@ Import Namespace="Aurigma.GraphicsMill"%>
<%@ Import Namespace="Aurigma.GraphicsMill.Codecs"%>
<%@ Import Namespace="Aurigma.GraphicsMill.Transforms"%>
<script language="c#" runat="server">
#region pageload
private void Page_Load(object sender, System.EventArgs e)
{
	Bitmap bitmap = new Bitmap(Server.MapPath(@"SourceImages/Mountain.jpg"));
	
	//Resize to 100 pixels width
	bitmap.Transforms.Resize(100, 0, InterpolationMode.MediumQuality);

	//Save image to response stream
	Response.Clear();
	bitmap.Save(Response.OutputStream, new JpegEncoderOptions(70, true));
	Response.End();
}
#endregion
</script>

See Also

Reference