Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: SVG to Raster Inverting Some Fills

$
0
0
When converting an SVG with fills to PNG format, some of the fills are being inverted and I'm not sure why. Anyone ever see this and what did you do about it?

Here's a link to a screenshot of my issue and the SVG file I'm using: https://www.dropbox.com/sh/snh3qcdo63ur344/AACP-gBaFN4wqI9PQbY-dNL2a?dl=0

Here's my code - which is pretty basic:
 // Read SVG image from file
                MagickImageInfo info = new MagickImageInfo(sourceName.Value.ToString());
                debugLoc = "Reading Image Info";

                iwide = info.Width;
                iheight = info.Height;

                // Assume ResolutionX and ResolutionY are the same
                double density = info.ResolutionX;

                // Maximum width or height
                int maxSize = 500;

                // Calculate best density
                while (density > 0.0 &&
                       (
                         (density * (info.Width / info.ResolutionX) > maxSize) ||
                         (density * (info.Height / info.ResolutionX) > maxSize))
                       )
                {
                    density--;
                }

                MagickReadSettings settings = new MagickReadSettings()
                {
                    Density = new PointD(density)
                };


                debugLoc = "Getting image";
                MagickNET.SetTempDirectory(Path.GetDirectoryName(targetName.Value.ToString()));
                using (MagickImage image = new MagickImage(sourceName.Value.ToString()))
                // 
                
                {
                    image.Format = (MagickFormat)Enum.Parse(typeof(MagickFormat), fileType.Value.ToString(), true);
                    image.Write(string.Concat(targetName.Value.ToString(), ".", fileType.Value.ToString()));
                }

Viewing all articles
Browse latest Browse all 3693

Trending Articles