SvgImage Constructor (Stream)
Initializes a new instance of the SvgImage class.

Namespace: Aspose.Imaging.FileFormats.Svg
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
Syntax
public SvgImage(
	Stream stream
)

Parameters

stream
Type: System.IOStream
The stream to load image from and initialize pixel and palette data with.
Exceptions
ExceptionCondition
ArgumentNullExceptionstream is null.
Examples
This example shows how to load an SVG image from a file stream and rasterize it to PNG.
[C#]

string dir = "c:\\temp\\";

// Load an SVG image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "test.svg"))
using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = new Aspose.Imaging.FileFormats.Svg.SvgImage(stream))
{
    // In order to rasterize SVG we need to specify rasterization options.
    Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
    Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
    saveOptions.VectorRasterizationOptions = rasterizationOptions;

    svgImage.Save(dir + "test.output.png", saveOptions);
}
See Also