This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/load-a-file/imaging/from-stream-svg.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Load a vector image (SVG) from stream in C# .NET | Nutrient .NET SDK
SVG

To load an SVG image from a Stream, use the CreateGdPictureImageFromStream method from the GdPictureImaging class.

This method returns a non-zero GdPicture image identifier (imageID) on success. If it fails, it returns 0 — use GetStat() to view the failure reason.

For SVG stream input, the filename-based overload is useful because the extension helps format detection:

  • CreateGdPictureImageFromStream(Stream, string FileName)

Remember to release image resources with the ReleaseGdPictureImage method.

To load an SVG image from a stream, use the following code:

using GdPicture14;
using System;
using System.IO;
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a stream object from an SVG file.
using Stream streamImage = new FileStream(@"C:\temp\source.svg", FileMode.Open, FileAccess.Read);
// Create a GdPicture image from the stream object.
int imageID = gdpictureImaging.CreateGdPictureImageFromStream(streamImage, "source.svg");
if (imageID == 0)
{
Console.WriteLine($"CreateGdPictureImageFromStream failed: {gdpictureImaging.GetStat()}");
return;
}
GdPictureStatus status = gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAsPNG failed: {status}");
}
gdpictureImaging.ReleaseGdPictureImage(imageID);