This unit makes it very easy to load SVG files into TImage32 objects. Just include this unit in your project's uses section and the TImage32 object's LoadFromXXXX methods will pretty much do the rest.
- The TImage32 object only stores a rasterized image, so the SVG image will be rasterized when loaded.
- This unit only supports loading SVG images (not saving them) because converting raster images to vector images isn't normally recommended.
- Because vector images scale without losing any image quality, they should be loaded (ie rendered) into TImage32 objects that have been pre-sized. (This avoids the loss of image quality you'll get when scaling raster images.) When loading, the SVG image will scale to best fit the TImage32 object's size, while also preserving its height/width ratio. If you need an image rendered at the SVG image's native size, then make sure the TImage32 object is empty (ie zero width and height) before calling its load method.
uses Img32, Img32.Fmt.SVG, Img32.Fmt.PNG;
//change image format from SVG to PNG
img := TImage32.Create(800,600);
TImage32.LoadFromFile, TImage32.LoadFromResource, TImage32.LoadFromStream
Copyright ©2019 Angus Johnson - Image32 ver. 3.2 - Documentation last updated on 15-September-2021