Problem convert svg to jpg (win 7 system)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
HelloTom
Posts: 3
Joined: 2012-11-02T13:54:16-07:00
Authentication code: 67789

Problem convert svg to jpg (win 7 system)

Post by HelloTom »

Hello,

I have a problem to convert a svg file created with matlab to a jpg (or gif) file.

In firefox it looks ok:

Image

But converted it looks bad:

Image

The code is:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg preserveAspectRatio="xMinYMin meet" width="100%" height="100%" viewBox="0 0 750.000 562.500"  version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <desc>Matlab Figure Converted by PLOT2SVG written by Juerg Schwizer</desc>
  <g id="topgroup">
  <rect x="0" y="0" width="750.000" height="562.500" fill="#ffffff" stroke="none" />
  <g id ="ID000000">
  <clipPath id="ID000001">
    <rect x="97.500" y="42.188" width="581.250" height="458.437"/>
  </clipPath>
      <polygon fill="#ffffff" fill-opacity="1.00" stroke="none" stroke-width="0.5pt" stroke-opacity="1.00" stroke-dasharray="none" points="97.500,500.625 678.750,500.625 678.750,42.188 97.500,42.188 "/>
      <polygon fill="#ffffff" fill-opacity="1.00" stroke="none" stroke-width="0.5pt" stroke-opacity="1.00" stroke-dasharray="none" points="97.500,42.188 678.750,42.188 678.750,42.188 97.500,42.188 "/>
      <polygon fill="#ffffff" fill-opacity="1.00" stroke="none" stroke-width="0.5pt" stroke-opacity="1.00" stroke-dasharray="none" points="97.500,500.625 97.500,500.625 97.500,42.188 97.500,42.188 "/>
    <g>
<defs>
  <filter x="0.000%" y="0.000%" width="100.000%" height="100.000%" id="ID000002">
  <feGaussianBlur result="blur" in="SourceGraphic" stdDeviation="4.000" />
  <feOffset result="shade" in="blur" dx="4.000" dy="4.000" />
  </filter>
</defs>
<g id="ID000003" filter="url(#ID000002)">
<rect x="85.500" y="30.188" width="605.250" height="482.437" fill="none" stroke="none" />
  <g transform="translate(155.625,464.906)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Arial" text-anchor="start" font-size="23pt" fill="#007f7f" >HALLO</text>
    </g>
  </g>
</g>
<g id="ID000004" >
  <g transform="translate(155.625,464.906)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="start" font-size="23pt" fill="#007f7f" >HALLO</text>
    </g>
  </g>
</g>
<defs>
  <filter x="0.000%" y="0.000%" width="100.000%" height="100.000%" id="ID000005">
  <feGaussianBlur result="blur" in="SourceGraphic" stdDeviation="4.000" />
  <feOffset result="shade" in="blur" dx="4.000" dy="4.000" />
  </filter>
</defs>
<g id="ID000006" filter="url(#ID000005)">
<rect x="85.500" y="30.188" width="605.250" height="482.437" fill="none" stroke="none" />
  <g transform="translate(388.125,281.531)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Arial" text-anchor="start" font-size="23pt" fill="#007f7f" >HALLO</text>
    </g>
  </g>
</g>
<g id="ID000007" >
  <g transform="translate(388.125,281.531)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="start" font-size="23pt" fill="#007f7f" >HALLO</text>
    </g>
  </g>
</g>
<g id="ID000008" >
</g>
<g id="ID000009" >
</g>
<g id="ID000010" >
</g>
    </g>
    <g>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 97.500,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="155.625,500.625 155.625,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="213.750,500.625 213.750,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="271.875,500.625 271.875,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="330.000,500.625 330.000,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="388.125,500.625 388.125,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="446.250,500.625 446.250,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="504.375,500.625 504.375,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="562.500,500.625 562.500,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="620.625,500.625 620.625,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="678.750,500.625 678.750,494.813 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 678.750,500.625 "/>
  <g transform="translate(97.500,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0</text>
    </g>
  </g>
  <g transform="translate(155.625,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.1</text>
    </g>
  </g>
  <g transform="translate(213.750,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.2</text>
    </g>
  </g>
  <g transform="translate(271.875,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.3</text>
    </g>
  </g>
  <g transform="translate(330.000,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.4</text>
    </g>
  </g>
  <g transform="translate(388.125,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.5</text>
    </g>
  </g>
  <g transform="translate(446.250,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.6</text>
    </g>
  </g>
  <g transform="translate(504.375,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.7</text>
    </g>
  </g>
  <g transform="translate(562.500,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.8</text>
    </g>
  </g>
  <g transform="translate(620.625,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >0.9</text>
    </g>
  </g>
  <g transform="translate(678.750,520.856)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="middle" font-size="9pt" fill="#000000" >1</text>
    </g>
  </g>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 103.313,500.625 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,454.781 103.313,454.781 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,408.938 103.313,408.938 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,363.094 103.313,363.094 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,317.250 103.313,317.250 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,271.406 103.313,271.406 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,225.563 103.313,225.563 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,179.719 103.313,179.719 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,133.875 103.313,133.875 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,88.031 103.313,88.031 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,42.188 103.313,42.188 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 97.500,42.188 "/>
  <g transform="translate(85.875,504.844)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0</text>
    </g>
  </g>
  <g transform="translate(85.875,459.000)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.1</text>
    </g>
  </g>
  <g transform="translate(85.875,413.156)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.2</text>
    </g>
  </g>
  <g transform="translate(85.875,367.313)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.3</text>
    </g>
  </g>
  <g transform="translate(85.875,321.469)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.4</text>
    </g>
  </g>
  <g transform="translate(85.875,275.625)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.5</text>
    </g>
  </g>
  <g transform="translate(85.875,229.781)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.6</text>
    </g>
  </g>
  <g transform="translate(85.875,183.938)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.7</text>
    </g>
  </g>
  <g transform="translate(85.875,138.094)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.8</text>
    </g>
  </g>
  <g transform="translate(85.875,92.250)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >0.9</text>
    </g>
  </g>
  <g transform="translate(85.875,46.406)">
    <g transform="rotate(-0.0)">
      <text x="0.000" y="0.000" font-family="Helvetica" text-anchor="end" font-size="9pt" fill="#000000" >1</text>
    </g>
  </g>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 97.500,496.041 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 97.500,496.041 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 97.500,496.041 "/>
      <polyline fill="none" stroke="#000000" stroke-width="0.5pt" stroke-dasharray="none" points="97.500,500.625 97.500,500.625 "/>
    </g>
  </g>
  </g>
</svg>
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem convert svg to jpg (win 7 system)

Post by fmw42 »

Each SVG renderer can be different. They may all not recognized the full set of commands. Apparently some do not yet handle blur for shadow.

On my Mac, the shadow shows on Firefox and Opera, but not Safari.

In IM you can use the internal svg renderer, but if you want something more precise, install the RSVG delegate and see if that helps.
You can see if it is configured by

convert -list configure

and see if rsvg is listed on the line DELEGATES.

Or

convert -list format

and look at the line regarding SVG and see if it shows the RSVG rather than xml
HelloTom
Posts: 3
Joined: 2012-11-02T13:54:16-07:00
Authentication code: 67789

Re: Problem convert svg to jpg (win 7 system)

Post by HelloTom »

Ok I dont habe rsvg installed. Where can I get it and how to install it?

I tried http://opensourcepack.blogspot.de/2012/ ... -tool.html. Now I have a litte shadow but this looks not nice. I really trying to get the output from firefox.
HelloTom
Posts: 3
Joined: 2012-11-02T13:54:16-07:00
Authentication code: 67789

Re: Problem convert svg to jpg (win 7 system)

Post by HelloTom »

I found a workaround with another program http://inkscape.org/. With a batch file I can auto convert my files.
Post Reply