SvgImage

SvgImage constructor (1 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(string path)
Parameter Type Description
path String The path to load image from and initialize pixel and palette data with.

Exceptions

exception condition
ArgumentNullException path is null.

See Also


SvgImage constructor (2 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(Stream stream)
Parameter Type Description
stream Stream The stream to load image from and initialize pixel and palette data with.

Exceptions

exception condition
ArgumentNullException stream 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


SvgImage constructor (3 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(int width, int height)
Parameter Type Description
width Int32 The image width.
height Int32 The image height.

See Also


SvgImage constructor (4 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(SvgOptions svgOptions, int width, int height)
Parameter Type Description
svgOptions SvgOptions The SVG options.
width Int32 Image width.
height Int32 Image height.

See Also