SvgImage

SvgImage constructor (1 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(string path)
ParameterTypeDescription
pathStringThe path to load image from and initialize pixel and palette data with.

Exceptions

exceptioncondition
ArgumentNullExceptionpath is null.

See Also


SvgImage constructor (2 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(Stream stream)
ParameterTypeDescription
streamStreamThe 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


SvgImage constructor (3 of 4)

Initializes a new instance of the SvgImage class.

public SvgImage(int width, int height)
ParameterTypeDescription
widthInt32The image width.
heightInt32The 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)
ParameterTypeDescription
svgOptionsSvgOptionsThe SVG options.
widthInt32Image width.
heightInt32Image height.

See Also