Convert SVG to JPG with Pattern Image Background

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
macca
Posts: 2
Joined: 2019-03-29T02:49:49-07:00
Authentication code: 1152

Convert SVG to JPG with Pattern Image Background

Post by macca »

Hello,

I'm having an issue with converting svg pattern image backgrounds using inkscape. The output has a stroke around the pattern divides.

Image Magick Version : 7.0.8-33
OS : Mac OS 10.14.2

Code: Select all

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="2758" height="3886" viewBox="0 0 441.28000000000003 621.76" xml:space="preserve">
<defs>
<pattern id="SVGID_1" x="0" y="0" width="0.225" height="0.15">
<image x="0" y="0" width="400" height="400" xlink:href="file:////ABSPATH/TO/PATTERN.png"></image>
</pattern>
</defs>
<rect transform="translate(220.64000000000001,310.88)" x="-220.64000000000001" y="-310.88" width="441.28000000000003" height="621.76" fill="url(#SVGID_1)"></rect>
<g transform="matrix(1 0 0 1 220.64 194.02)" style=""  >
		<text xml:space="preserve" font-family="Open Sans" font-size="40" font-style="normal" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(255,255,0); fill-rule: nonzero; opacity: 1; white-space: pre;" ><tspan x="-92.48" y="12.57" >Edit text...</tspan></text>
</g>
</svg>
This is the command and output:

Code: Select all

convert -verbose 47-preview.svg test.pdf
'inkscape' '/var/folders/xp/jg25q_ws4tz9h1vj5ybqjmlh0000gn/T/magick-644318DHR_pixeebN' --export-png='/var/folders/xp/jg25q_ws4tz9h1vj5ybqjmlh0000gn/T/magick-644317ZEoFyeuzvbI' --export-dpi='96,96' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/var/folders/xp/jg25q_ws4tz9h1vj5ybqjmlh0000gn/T/magick-644310cS9BdGpRsYM' 2>&1
/var/folders/xp/jg25q_ws4tz9h1vj5ybqjmlh0000gn/T/magick-644317ZEoFyeuzvbI PNG 2758x3886 2758x3886+0+0 8-bit sRGB 3.28874MiB 1.920u 0:00.490
47-preview.svg SVG 2758x3886 2758x3886+0+0 8-bit sRGB 3.28874MiB 0.000u 0:00.000
47-preview.svg=>test.pdf SVG 2758x3886 2758x3886+0+0 8-bit sRGB 3.07023MiB 5.570u 0:04.799

Here is the generated image:
https://www.dropbox.com/s/dqpm74g9lefeify/test.jpg?dl=0


Any help would be greatly appreciated.

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

Re: Convert SVG to JPG with Pattern Image Background

Post by snibgo »

What is wrong with the output? Does it work when you use Inkscape standalone?

You haven't supplied PATTERN.png so we can't test the result.
snibgo's IM pages: im.snibgo.com
macca
Posts: 2
Joined: 2019-03-29T02:49:49-07:00
Authentication code: 1152

Re: Convert SVG to JPG with Pattern Image Background

Post by macca »

Hi snibgo,

Thanks for the reply, sorry here is the pattern.

https://www.dropbox.com/s/k2nxirdlf6np7 ... c.png?dl=0

The issue is that the white/grey lines between the divides shouldn't be there.

EDIT: it does save correctly when exported via inkscape gui but not the command line. Perhaps this is an inkscape issue then?

Thanks again
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG to JPG with Pattern Image Background

Post by fmw42 »

I get a red grid with yellow text using Inkscape 0.92.4 with Imagemagick 7.0.8.35 Q16 Mac OSX Sierra.

Note that when using IM 7, you should use magick and not convert and not magick convert either.
Post Reply