This project has moved. For the latest updates, please go here.

SVG to Raster Inverting Some Fills

Feb 19, 2015 at 2:11 PM
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:

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))

                MagickReadSettings settings = new MagickReadSettings()
                    Density = new PointD(density)

                debugLoc = "Getting image";
                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()));
Feb 19, 2015 at 6:43 PM
The rsvg library that is used to read SVG files does not understand the color when it is written in UPPERCASE. The following works: rgb(71,59,52), but it does not understand RGB(71,59,52).

p.s. Are you aware that you are not using the settings?
Feb 19, 2015 at 7:01 PM
I guess I was not aware, but not sure how that would help me in this case? How do I need to implement them....?
Feb 19, 2015 at 7:31 PM
Edited Feb 19, 2015 at 7:50 PM
The comment about the settings was just that you create it but don't pass it as a parameter to the MagickImage constructor. That won't help you with this problem. The only thing that you could do is replace 'RGB' with 'rgb'. Since SVG is XML you could probably automate this.
Feb 19, 2015 at 7:32 PM
Got it - thanks.