svg convert

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
efeu
Posts: 2
Joined: 2016-12-15T06:54:50-07:00
Authentication code: 1151

svg convert

Post by efeu »

Hi,
first of all this function is only "half" working on ImageMagick 6.8.9-9, every other version I tested up to 7.0.3-10 did not work "a bit".

I have some svgs where I draw a "hatch", I'm filling some svg objects with that (a repeated line):

<pattern id="horizontalHatch" patternUnits="userSpaceOnUse" width="100" height="100" ><path d="M -1,8 l 101,0" style="stroke:#000000; stroke-width:1" /></pattern>

Then for my "svg-object":

<g fill="url(#horizontalHatch)" stroke="#FFFFFF" stroke-width="1">
...
paths
...
</g>

And then I want to convert it to bitmap.

So only the mentioned imagemagick version is recognizing the pattern-fill at all, all other imagemagick versions ignore it.

But now it's getting weired, if the starting point of the pattern path "M -1,8 l 101,0" is going to be to "high" ex.(M -1,50 l 101,0), then it is also beeing ignored :? While nothing else is changing.

Somewhere I read that I have to compile it by myself with librsvg2-dev, but it didnt solve the problem, or do I need a special version of librsvg2-dev?

Why I'm doing this with imagemagick? Cause you cant get rid of the blur effect inkscape is drawing on the output png via cli.

So anyone got an idea?

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

Re: svg convert

Post by snibgo »

I suggest you link to (or paste here, between quotes) a complete SVG that shows the problem.
snibgo's IM pages: im.snibgo.com
efeu
Posts: 2
Joined: 2016-12-15T06:54:50-07:00
Authentication code: 1151

Re: svg convert

Post by efeu »

Hi,

here two examples:

Code: Select all

<?xml version="1.0" standalone="yes"?>
<svg width="467" height="629">
<pattern id="verticalHatch" patternUnits="userSpaceOnUse" width="100" height="90" ><path d="M -1,1 l 101,0" style="stroke:#000000; stroke-width:1" /></pattern><g fill="url(#verticalHatch)" stroke="#000000" stroke-width="1" stroke-position="middle">
<path style="" d="M217.96 5.56635C171.935 9.89166 125.014 24.8134 90 56.1698C34.7463 105.651 14.9502 183.799 7.83102 255C4.97458 283.568 2.53248 313.516 7.62963 342C17.1798 395.368 44.2694 443.404 74 488C100.945 528.418 129.946 570.673 170.039 599.194C192.129 614.909 218.783 626.347 246.424 623.691C271.177 621.313 293.33 607.665 312 592.08C345.421 564.182 372.508 527.789 395.424 491C417.006 456.35 437.439 420.315 449.28 381C462.117 338.379 464.162 294.199 461.068 249.989C458.444 212.492 454.981 175.513 441.575 140C417.972 77.4772 364.498 32.071 301 14.2939C274.434 6.85657 245.534 2.97498 217.96 5.56635M211 485C135.787 484.842 68.3135 438.891 46.5895 366C42.9863 353.91 39.105 340.68 39 328C95.8014 332.489 155.402 368.636 184.91 417C198.022 438.49 203.449 461.386 211 485M431 328C414.075 409.78 343.537 480.327 258 484C261.86 427.318 298.174 370.27 350 346.309C376.236 334.18 402.719 331.078 431 328z"/>
</g></svg>

Code: Select all

<?xml version="1.0" standalone="yes"?>
<svg width="467" height="629">
<pattern id="verticalHatch" patternUnits="userSpaceOnUse" width="100" height="90" ><path d="M -1,31 l 101,0" style="stroke:#000000; stroke-width:1" /></pattern><g fill="url(#verticalHatch)" stroke="#000000" stroke-width="1" stroke-position="middle">
<path style="" d="M217.96 5.56635C171.935 9.89166 125.014 24.8134 90 56.1698C34.7463 105.651 14.9502 183.799 7.83102 255C4.97458 283.568 2.53248 313.516 7.62963 342C17.1798 395.368 44.2694 443.404 74 488C100.945 528.418 129.946 570.673 170.039 599.194C192.129 614.909 218.783 626.347 246.424 623.691C271.177 621.313 293.33 607.665 312 592.08C345.421 564.182 372.508 527.789 395.424 491C417.006 456.35 437.439 420.315 449.28 381C462.117 338.379 464.162 294.199 461.068 249.989C458.444 212.492 454.981 175.513 441.575 140C417.972 77.4772 364.498 32.071 301 14.2939C274.434 6.85657 245.534 2.97498 217.96 5.56635M211 485C135.787 484.842 68.3135 438.891 46.5895 366C42.9863 353.91 39.105 340.68 39 328C95.8014 332.489 155.402 368.636 184.91 417C198.022 438.49 203.449 461.386 211 485M431 328C414.075 409.78 343.537 480.327 258 484C261.86 427.318 298.174 370.27 350 346.309C376.236 334.18 402.719 331.078 431 328z"/>
</g></svg>
I just do a simple convert to png on cli results in the first one beeing "hatched", and the second one is just the outline. No idea where this comes from.

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

Re: svg convert

Post by snibgo »

IM has three rendering engines for SVG. They are: MSVG, RSVG and Inkscape. I tried this in all three, and they all worked.

Windows 8.1, IM v6.9.5-3. Inkscape 0.91.

I changed the pattern colour from #000000 to #00ff00.

Code: Select all

convert hatch2.svg hatch2_svg.png
Image
snibgo's IM pages: im.snibgo.com
Post Reply