Save images in C#
To Vector
A vector graphic file is an image that can be scaled to any size without losing quality. While standard images are constructed as a set of pixels, vector images consist of mathematically defined simple shapes. One of the most popular vector image formats is SVG.
To save a GdPicture image to an SVG image, use the SaveAsSVG
method of the GdPictureDocumentConverter
class. It requires the file path to the newly created SVG image.
In the conversion process, the vector content is preserved as much as possible. If the source contains multiple pages (such as a PDF document or a TIFF image), only the first page is converted.
To save an image in SVG format, use the following example:
using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();// Load a PDF document.gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF);// Save the PDF document as an SVG image.gdpictureDocumentConverter.SaveAsSVG(@"C:\temp\output.svg");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter() ' Load a PDF document. gdpictureDocumentConverter.LoadFromFile("C:\temp\source.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF) ' Save the PDF document as an SVG image. gdpictureDocumentConverter.SaveAsSVG("C:\temp\output.svg")End Using