Wrong SVG conversion

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
tombert
Posts: 4
Joined: 2013-01-14T12:16:13-07:00
Authentication code: 6789

Wrong SVG conversion

Post by tombert »

Hi all,

I do have a small svg file which is converted (to png) wrongly. It looks like that circles and rectangles are filled black which should not. Can I upload this svg somewhere?

thx
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong SVG conversion

Post by snibgo »

If it really is small, open it in a text editor and copy/paste the contents here. Put it within [ code ] and [ / code ] brackets so it doesn't lose the spacing.
snibgo's IM pages: im.snibgo.com
tombert
Posts: 4
Joined: 2013-01-14T12:16:13-07:00
Authentication code: 6789

Re: Wrong SVG conversion

Post by tombert »

Ok - here you go: (It is an Visio export)

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 smallest.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="8.26772in"
		height="11.6929in" viewBox="0 0 595.276 841.89" xml:space="preserve" color-interpolation-filters="sRGB" class="st8">
	<v:documentProperties v:langID="3079" v:metric="true" v:viewMarkup="false">
		<v:userDefs>
			<v:ud v:nameU="CPMState" v:prompt="" v:val="VT4(67108992,715,50,343,200,0)"/>
		</v:userDefs>
	</v:documentProperties>

	<style type="text/css">
	<![CDATA[
		.st1 {stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2}
		.st2 {fill:none;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2}
		.st3 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2}
		.st4 {fill:#000000;font-family:Arial Unicode MS;font-size:0.333344em}
		.st5 {fill:#000000;font-family:Arial Unicode MS;font-size:0.121674em}
		.st6 {fill:#ffffff;fill-opacity:0;stroke:#99ccff;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2}
		.st7 {stroke:#000000;stroke-linecap:butt;stroke-width:1.2}
		.st8 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
	]]>
	</style>

	<g v:mID="0" v:index="1" v:groupContext="foregroundPage">
		<title>Page-1</title>
		<v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394"
				v:shadowOffsetY="-8.50394"/>
		<v:layer v:name="7" v:index="0" color="#000000"/>
		<v:layer v:name="1" v:index="1" color="#000000"/>
		<v:layer v:name="3" v:index="2" color="#000000"/>
		<v:layer v:name="2" v:index="3" color="#000000"/>
		<g id="shape15-1" v:mID="15" v:groupContext="shape" transform="translate(232.541,-421.534)">
			<title>Dynamic connector.423</title>
			<v:custProps>
				<v:cp v:nameU="name" v:lbl="name" v:prompt="ATT02_SC11" v:type="0" v:format="" v:sortKey="" v:invis="false"
						v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				<v:cp v:nameU="type" v:lbl="type" v:prompt="path" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
						v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				<v:cp v:nameU="" v:lbl="onUpdate"
						v:prompt="this.copyEnabled(M{AWG1_AT02});&#10;if (%{AT02.gain} >= 50) {&#10;    this.setEnabledStyle('stroke: green;');&#10;} else {&#10;    this.setEnabledStyle('stroke: red;');&#10;}"
						v:type="0" v:langID="1031"/>
			</v:custProps>
			<path d="M0 848.95 L-51.67 849" class="st1"/>
		</g>
		<g id="shape41-4" v:mID="41" v:groupContext="shape" transform="translate(338.74,-396.419)">
			<title>Dynamic connector.41</title>
			<v:custProps>
				<v:cp v:nameU="name" v:lbl="name" v:prompt="SC11_p2" v:type="0" v:format="" v:sortKey="" v:invis="false"
						v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				<v:cp v:nameU="type" v:lbl="type" v:prompt="path" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
						v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				<v:cp v:nameU="" v:lbl="onUpdate"
						v:prompt="if (%{SC11.position} == 2) {&#10;    this.copyEnabled(M{ATT02_SC11});&#10;    this.copyStyle(M{ATT02_SC11});&#10;} else {&#10;    this.setEnabled(false);&#10;}"
						v:type="0" v:langID="1031"/>
			</v:custProps>
			<path d="M0 834.81 L0 834.8 L-78.28 834.8" class="st1"/>
		</g>
		<g id="shape40-7" v:mID="40" v:groupContext="shape" transform="translate(338.74,-418.179)">
			<title>Dynamic connector.40</title>
			<v:custProps>
				<v:cp v:nameU="name" v:lbl="name" v:prompt="SC11_p1" v:type="0" v:format="" v:sortKey="" v:invis="false"
						v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				<v:cp v:nameU="type" v:lbl="type" v:prompt="path" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
						v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				<v:cp v:nameU="" v:lbl="onUpdate"
						v:prompt="if (%{SC11.position} == 1) {&#10;    this.copyEnabled(M{ATT02_SC11});&#10;    this.copyStyle(M{ATT02_SC11});&#10;} else {&#10;    this.setEnabled(false);&#10;}"
						v:type="0" v:langID="1031"/>
			</v:custProps>
			<path d="M0 834.81 L0 834.8 L-78.31 834.8" class="st1"/>
		</g>
		<g id="group18-10" transform="translate(209.055,-391.853)" v:mID="18" v:groupContext="group">
			<v:custProps>
				<v:cp v:nameU="" v:lbl="name" v:prompt="SC11" v:type="0" v:langID="1031"/>
				<v:cp v:nameU="" v:lbl="type" v:prompt="switch" v:type="0" v:langID="1031"/>
				<v:cp v:nameU="" v:lbl="onUpdate" v:prompt="this.setPosition(%{$this.position});" v:type="0" v:langID="1031"/>
			</v:custProps>
			<title>Sheet.18</title>
			<g id="shape2-11" v:mID="2" v:groupContext="shape" transform="translate(16.2462,0)">
				<title>Circle.1</title>
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="switch_circle" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<v:userDefs>
					<v:ud v:nameU="visVersion" v:val="VT0(11):26"/>
				</v:userDefs>
				<path d="M0 819.27 A22.6178 22.6178 0 0 1 45.24 819.27 A22.6178 22.6178 0 1 1 0 819.27 Z" class="st2"/>
			</g>
			<g id="shape4-13" v:mID="4" v:groupContext="shape" transform="translate(0,-50.2543)">
				<title>Sheet.4</title>
				<desc>SC11</desc>
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="switch_name" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/>
				<v:textRect cx="38.9764" cy="838.298" width="77.96" height="7.18449"/>
				<rect x="0" y="834.705" width="77.9528" height="7.18449" class="st3"/>
				<text x="33.97" y="839.5" class="st4" v:langID="1038"><v:paragraph v:horizAlign="1"/><v:tabList/>SC11</text>			</g>
			<g id="shape5-16" v:mID="5" v:groupContext="shape" transform="translate(23.4862,-21.5267)">
				<title>Circle.204</title>
				<v:userDefs>
					<v:ud v:nameU="visVersion" v:val="VT0(11):26"/>
				</v:userDefs>
				<path d="M0 840.8 A1.09111 1.09111 0 0 1 2.18 840.8 A1.09111 1.09111 0 0 1 0 840.8 Z" class="st2"/>
			</g>
			<g id="shape6-18" v:mID="6" v:groupContext="shape" v:layerMember="0" transform="translate(64.7383,-11.7835)">
				<title>Sheet.6</title>
				<desc>2</desc>
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="text_2" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					<v:cp v:nameU="" v:lbl="" v:prompt="" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
							v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<v:userDefs>
					<v:ud v:nameU="DWGTextHAlign" v:prompt="0=left, 0.5=center, 1=right" v:val="VT0(0.5):1"/>
					<v:ud v:nameU="DWGTextVAlign" v:prompt="0=bottom, 0.5=middle, 1=top" v:val="VT0(0.5):1"/>
					<v:ud v:nameU="SOLSH" v:prompt="" v:val="VT4({13D0FF3B-CF5B-4a46-98AB-14030248EAEF})"/>
					<v:ud v:nameU="DWGEntityType" v:prompt="" v:val="VT4(TEXT)"/>
				</v:userDefs>
				<v:textBlock v:margins="rect(0,0,0,0)"/>
				<v:textRect cx="2.55729" cy="839.08" width="5.12" height="5.62021"/>
				<rect x="0" y="836.27" width="5.11458" height="5.62021" class="st3"/>
				<text x="2.14" y="839.52" class="st5" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>2</text>			</g>
			<g id="shape7-21" v:mID="7" v:groupContext="shape" v:layerMember="0" transform="translate(8.00607,-22.9368)">
				<title>Sheet.7</title>
				<desc>C</desc>
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="text_C" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<v:userDefs>
					<v:ud v:nameU="DWGTextHAlign" v:prompt="0=left, 0.5=center, 1=right" v:val="VT0(0.5):1"/>
					<v:ud v:nameU="DWGTextVAlign" v:prompt="0=bottom, 0.5=middle, 1=top" v:val="VT0(0.5):1"/>
					<v:ud v:nameU="SOLSH" v:prompt="" v:val="VT4({13D0FF3B-CF5B-4a46-98AB-14030248EAEF})"/>
					<v:ud v:nameU="DWGEntityType" v:prompt="" v:val="VT4(TEXT)"/>
				</v:userDefs>
				<v:textBlock v:margins="rect(0,0,0,0)"/>
				<v:textRect cx="2.55729" cy="839.08" width="5.12" height="5.62021"/>
				<rect x="0" y="836.27" width="5.11458" height="5.62021" class="st3"/>
				<text x="2.02" y="839.52" class="st5" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>C</text>			</g>
			<g id="shape8-24" v:mID="8" v:groupContext="shape" v:layerMember="0" transform="translate(64.7383,-33.8767)">
				<title>Sheet.8</title>
				<desc>1</desc>
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="text_1" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<v:userDefs>
					<v:ud v:nameU="DWGTextHAlign" v:prompt="0=left, 0.5=center, 1=right" v:val="VT0(0.5):1"/>
					<v:ud v:nameU="DWGTextVAlign" v:prompt="0=bottom, 0.5=middle, 1=top" v:val="VT0(0.5):1"/>
					<v:ud v:nameU="SOLSH" v:prompt="" v:val="VT4({13D0FF3B-CF5B-4a46-98AB-14030248EAEF})"/>
					<v:ud v:nameU="DWGEntityType" v:prompt="" v:val="VT4(TEXT)"/>
				</v:userDefs>
				<v:textBlock v:margins="rect(0,0,0,0)"/>
				<v:textRect cx="2.55729" cy="839.08" width="5.12" height="5.62021"/>
				<rect x="0" y="836.27" width="5.11458" height="5.62021" class="st3"/>
				<text x="2.14" y="839.52" class="st5" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>1</text>			</g>
			<g id="group9-27" transform="translate(46.4678,-29.5964)" v:mID="9" v:groupContext="group">
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="fang_1" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					<v:cp v:nameU="" v:lbl="type" v:prompt="ui" v:type="0" v:langID="1031"/>
					<v:cp v:nameU="lbutton" v:lbl="onLButton" v:prompt="modifySignals('$context.position', 1);" v:type="0"
							v:format="" v:sortKey="" v:invis="false" v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<title>Sheet.9</title>
				<g id="shape10-28" v:mID="10" v:groupContext="shape" transform="translate(2.72778,-2.72778)">
					<title>Circle.211</title>
					<v:userDefs>
						<v:ud v:nameU="visVersion" v:val="VT0(11):26"/>
					</v:userDefs>
					<path d="M0 840.8 A1.09111 1.09111 0 0 1 2.18 840.8 A1.09111 1.09111 0 0 1 0 840.8 Z" class="st2"/>
				</g>
				<g id="shape11-30" v:mID="11" v:groupContext="shape">
					<title>Circle.208</title>
					<v:custProps>
						<v:cp v:nameU="name" v:lbl="name" v:prompt="border" v:type="0" v:format="" v:sortKey="" v:invis="false"
								v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					</v:custProps>
					<v:userDefs>
						<v:ud v:nameU="visVersion" v:val="VT0(11):26"/>
					</v:userDefs>
					<path d="M0 838.07 A3.81889 3.81889 0 1 1 7.64 838.07 A3.81889 3.81889 0 0 1 0 838.07 Z" class="st6"/>
				</g>
			</g>
			<g id="group1-32" transform="translate(46.4961,-7.83634)" v:mID="1" v:groupContext="group">
				<v:custProps>
					<v:cp v:nameU="name" v:lbl="name" v:prompt="fang_2" v:type="0" v:format="" v:sortKey="" v:invis="false"
							v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					<v:cp v:nameU="" v:lbl="type" v:prompt="ui" v:type="0" v:langID="1031"/>
					<v:cp v:nameU="lbutton" v:lbl="onLButton" v:prompt="modifySignals('$context.position', 2);" v:type="0"
							v:format="" v:sortKey="" v:invis="false" v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
				</v:custProps>
				<title>Sheet.1</title>
				<g id="shape16-33" v:mID="16" v:groupContext="shape" transform="translate(2.72778,-2.72778)">
					<title>Circle.211</title>
					<v:userDefs>
						<v:ud v:nameU="visVersion" v:val="VT0(11):26"/>
					</v:userDefs>
					<path d="M0 840.8 A1.09111 1.09111 0 0 1 2.18 840.8 A1.09111 1.09111 0 0 1 0 840.8 Z" class="st2"/>
				</g>
				<g id="shape17-35" v:mID="17" v:groupContext="shape">
					<title>Circle.208</title>
					<v:custProps>
						<v:cp v:nameU="name" v:lbl="name" v:prompt="border" v:type="0" v:format="" v:sortKey="" v:invis="false"
								v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					</v:custProps>
					<v:userDefs>
						<v:ud v:nameU="visVersion" v:val="VT0(11):26"/>
					</v:userDefs>
					<path d="M0 838.07 A3.81889 3.81889 0 1 1 7.64 838.07 A3.81889 3.81889 0 0 1 0 838.07 Z" class="st6"/>
				</g>
			</g>
			<g id="group12-37" transform="translate(25.4629,-21.2487)" v:mID="12" v:groupContext="group">
				<v:custProps>
					<v:cp v:nameU="" v:lbl="layer" v:prompt="position_1" v:type="0" v:langID="1031"/>
				</v:custProps>
				<title>Sheet.12</title>
				<g id="shape3-38" v:mID="3" v:groupContext="shape">
					<title>Dynamic connector.18</title>
					<v:custProps>
						<v:cp v:nameU="name" v:lbl="name" v:prompt="connector" v:type="0" v:format="" v:sortKey="" v:invis="false"
								v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					</v:custProps>
					<path d="M0 839.88 L23.73 829.72" class="st7"/>
				</g>
			</g>
			<g id="group13-41" transform="translate(25.405,-9.69444)" v:mID="13" v:groupContext="group">
				<v:custProps>
					<v:cp v:nameU="" v:lbl="layer" v:prompt="position_2" v:type="0" v:langID="1031" v:val="VT4()"/>
				</v:custProps>
				<title>Sheet.13</title>
				<g id="shape14-42" v:mID="14" v:groupContext="shape" transform="translate(4.19664E-014,-14.1732)">
					<title>Dynamic connector.18</title>
					<v:custProps>
						<v:cp v:nameU="name" v:lbl="name" v:prompt="connector" v:type="0" v:format="" v:sortKey="" v:invis="false"
								v:ask="false" v:langID="1033" v:cal="0" v:val="VT0(0):26"/>
					</v:custProps>
					<path d="M0 843.85 L23.82 854.1" class="st7"/>
				</g>
			</g>
		</g>
	</g>
</svg>
tombert
Posts: 4
Joined: 2013-01-14T12:16:13-07:00
Authentication code: 6789

Re: Wrong SVG conversion

Post by tombert »

The Bug appears in Windows ImageMagick 6.8.1-9 2013-01-04 16
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Wrong SVG conversion

Post by magick »

Under Windows, ImageMagick utilizes the internal SVG renderer which is not a complete implementation of SVG. We work on it over time but it may be quite some time before it can handle all / most of the SVG specification. Your SVG image renders fine under Linux because we use a delegate library to render the SVG instead.
tombert
Posts: 4
Joined: 2013-01-14T12:16:13-07:00
Authentication code: 6789

Re: Wrong SVG conversion

Post by tombert »

Ok - thx for letting me know.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong SVG conversion

Post by snibgo »

I notice that the SVG contains an embedded CSS style sheet. I suspect that is the sticking point.

Inkscape 0.47 gives the same result as IM. However, the current Inkscape (0.48.4) gives a result that looks far better.

Code: Select all

inkscape -f visio.svg -e v.png -y 1
snibgo's IM pages: im.snibgo.com
Post Reply