- About Graphics Mill
- What's New?
- Breaking Changes in Graphics Mill 12
- Breaking Changes in Graphics Mill 11
- Features
- Supported File Formats
- System Requirements
- Getting Started
- Working with Image Formats
- Transforming Images (Resize, Rotate, Crop)
- Working with Metadata
- Color Management and Color Reduction
- Drawing Text and Graphics
- Color Keying (Green Screen Removal)
- Channels and Pixel Data
- Color and Tone Correction
- Working with Photoshop (PSD) Files
- Image Filters
- Processing Large Images
- Basics of Image Processing
- Troubleshooting
- Class Library Reference
- Aurigma.GraphicsMill Namespace
- Aurigma.GraphicsMill.Codecs Namespace
- AdobeResourceBlock Class
- AdobeResourceDictionary Class
- BmpReader Class
- BmpSettings Class
- BmpWriter Class
- CIP4 Class
- CodecRegistry Class
- ColorBitDepth Enumeration
- CompressionType Enumeration
- CustomImageReader Class
- CustomImageWriter Class
- CustomReaderCreateCallback Delegate
- DisposalMethod Enumeration
- EpsReader Class
- EpsSettings Class
- EpsWriter Class
- ExifDictionary Class
- ExifItemInfo Class
- FileFormat Enumeration
- Frame Class
- FrameCollection(TFrame) Class
- FrameCollectionBase Class
- GifFrame Class
- GifFrameSettings Class
- GifReader Class
- GifSettings Class
- GifWriter Class
- IImageReader Interface
- IImageWriter Interface
- ImageReader Class
- ImageWriter Class
- IMetadataWriter Interface
- IptcDictionary Class
- IXmpDictionary Interface
- JpegAlignToSampleSizeMode Enumeration
- JpegMarkerException Class
- JpegReader Class
- JpegScale Enumeration
- JpegSettings Class
- JpegWriter Class
- LosslessJpeg Class
- MediaCorruptedException Class
- MediaProviderException Class
- MediaUnsupportedException Class
- MetadataDictionary Class
- MetadataEnumerator Class
- MultiFrameException Class
- OutputIntent Class
- PdfFrame Class
- PdfPage Class
- PdfReader Class
- PdfSettings Class
- PdfTextOutputMode Enumeration
- PdfVtDictionary Class
- PdfVtOptions Class
- PdfWriter Class
- PngFrame Class
- PngReader Class
- PngSettings Class
- PngWriter Class
- RawReader Class
- ResolveImageArgs Class
- ResolveImageCallback Delegate
- ResolveProfileCallback Delegate
- SmartObjectCropTo Enumeration
- SvgReader Class
- SvgReaderSettings Class
- SvgSettings Class
- SvgWriter Class
- TgaReader Class
- TgaSettings Class
- TgaWriter Class
- TiffChannelType Enumeration
- TiffExtraChannel Class
- TiffExtraChannelCollection Class
- TiffExtraChannelEntry Class
- TiffFrame Class
- TiffReader Class
- TiffSettings Class
- TiffWriter Class
- WebPFrame Class
- WebPFrameFormat Enumeration
- WebPFrameSettings Class
- WebPReader Class
- WebPSettings Class
- WebPWriter Class
- WriterSettings Class
- XmpArrayNode Class
- XmpData Class
- XmpDictionaryNode Class
- XmpLocalizedTextItemNode Class
- XmpLocalizedTextNode Class
- XmpNamespace Class
- XmpNode Class
- XmpNodeType Enumeration
- XmpStructNode Class
- XmpTagNames Class
- XmpValueNode Class
- Aurigma.GraphicsMill.Codecs.ClippingPath Namespace
- Aurigma.GraphicsMill.Codecs.Psd Namespace
- Aurigma.GraphicsMill.Drawing Namespace
- Aurigma.GraphicsMill.Drawing.Art Namespace
- Aurigma.GraphicsMill.Drawing.Effects Namespace
- Aurigma.GraphicsMill.Licensing Namespace
- Aurigma.GraphicsMill.Templates Namespace
- Aurigma.GraphicsMill.Transforms Namespace
- Licensing
- End User License Agreement
- Copyright Notices
SvgReaderSettings.ResolveImage Property
Gets or sets the callback that loads the images that the SVG file references.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Syntax
public ResolveImageCallback ResolveImage { get; set; }
Property Value
A ResolveImageCallback delegate, ornull. The default value is null, which loads the images from the folder of the SVG file.Remarks
The reader calls this callback for every <image> element of the SVG file, except images embedded as data: URIs. Use it to load images that are stored somewhere else, for example, in another folder, in a database, or on a web server.
In the callback, set Image to a raster image or GraphicsContainer to vector content. If you set neither, the image is loaded from the folder of the SVG file.
If the callback throws an exception, the reader stops reading the file, and the SvgReader constructor throws this exception.
Examples
const string assetsPrefix = "assets/";
const string assetsFolder = @"Images";
var settings = new SvgReaderSettings();
// The SVG file refers to images in the "assets" folder, which is stored somewhere else.
settings.ResolveImage = args =>
{
if (args.Href.StartsWith(assetsPrefix, StringComparison.OrdinalIgnoreCase))
{
var fileName = System.IO.Path.Combine(assetsFolder, args.Href.Substring(assetsPrefix.Length));
// The reader takes the image when the property is set, so you can dispose the bitmap right away.
using (var bitmap = new Bitmap(fileName))
{
args.Image = bitmap;
}
}
// If you set neither Image nor GraphicsContainer, the image is loaded from the folder of the SVG file.
};
using (var reader = new SvgReader(@"Images\SvgWithImage.svg", settings))
using (var writer = ImageWriter.Create(@"Images\Output\SvgWithImage.png"))
{
Pipeline.Run(reader + writer);
}
The SVG file rendered with the image that the callback loads.