public BitmapSource Render(double pixelWidth, double pixelHeight, ImageTransformType transform)
        {
            pixelWidth = Math.Ceiling(pixelWidth);
            pixelHeight = Math.Ceiling(pixelHeight);

            System.Drawing.SizeF size = this.svg.GetDimensions();
            double scale = Math.Min(pixelWidth / size.Width, pixelHeight / size.Height);
            double bitmapWidth = Math.Ceiling(size.Width * scale);
            double bitmapHeight = Math.Ceiling(size.Height * scale);

            using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap((int)bitmapWidth, (int)bitmapHeight))
            using (ISvgRenderer render = SvgRenderer.FromImage(bitmap))
            using (MemoryStream stream = new MemoryStream())
            {
                render.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                render.ScaleTransform((float)scale, (float)scale);
                this.svg.Draw(render);

                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                stream.Seek(0, SeekOrigin.Begin);

                BitmapImage bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.StreamSource = stream;
                bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
                bitmapImage.EndInit();
                bitmapImage.Freeze();

                return ImageHelpers.ScaleBitmap(bitmapImage, (int)pixelWidth, (int)pixelHeight, transform);
            }
        }
        public OutputSet(SourceImage owner, string name)
        {
            this.owner = owner;
            this.name = name;
            this.description = string.Empty;
            this.expanded = true;
            this.transformType = ImageTransformType.None;
            this.outputType = ImageHelpers.IsBitmapType(owner.Image.FileType)
                ? owner.Image.FileType
                : ImageFileType.DefaultRasterize;
            this.images = new ObservableCollection<OutputImage>();

            this.UpdateSize();

            owner.PropertyChanged += this.OnOwnerPropertyChanged;
        }
 public BitmapSource Render(double pixelWidth, double pixelHeight, ImageTransformType transform)
 {
     return ImageHelpers.ScaleBitmap(this.source, pixelWidth, pixelHeight, transform);
 }