Imagemagick svg to jpg removes space when using åäö

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
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Imagemagick svg to jpg removes space when using åäö

Post by eleison »

I'm using imagemagick to convert svg files to jpg/png on server. Painly it doesn't render the jpg-image correct.

The problem occurs when I use åäö as first letter in the second word. Then it removes the space between the words. Example: jag är en ful älg -> jagär en ful älg.

Image sample: http://postimg.org/image/z3uhtvcwh/

This is a sample of svg code that renders wrong:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
 width="650px" height="650px" viewBox="0 0 650 650" enable-background="new 0 0 650 650" xml:space="preserve">
<text
transform="translate(197.08643,191.33691)"
id="text5"><tspan
x="-100"
y="0"
style="font-size:60px;fill:#000000;font-family:Arial">jag är jag är</tspan>
</text>
</svg>
Looking at the svg-image in an svg editor displays correct "jag är jag är". I have tried different fonts...

I call imagemagick with: convert 1.svg 1.jpg

Imagemagick version:

Code: Select all

Version: ImageMagick 6.8.0-0 2012-10-11 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
I am very thankful for any help!
( I also posted this on http://stackoverflow.com/questions/2050 ... -using-aao )
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick svg to jpg removes space when using åäö

Post by fmw42 »

Version: ImageMagick 6.8.0-0 2012-10-11 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
It would appear that you have no delegates. You would certainly need the jpeg delegate installed to create a jpg output. Also you would be better off using either RSVG or Inkscape delegates for dealing with the svg data rather than IM internal one which I think also needs XML delegate.

What do you get from

convert -list configure

in the line starting with DELEGATES

What platform are you using?

How did you install IM -- from source or binary?
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Imagemagick svg to jpg removes space when using åäö

Post by eleison »

Thanks for quick reply!

DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib

Am I missing something?

When converting same svg with inkscape cmd i get no errors.

I'm using windows 7 64bit.

I did install from binary. This was the only version of IM i got to work on my Wampserver configuration for php. :/
Last edited by eleison on 2013-12-10T16:00:09-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Imagemagick svg to jpg removes space when using åäö

Post by snibgo »

I use IM v6.8.7-0 on Windows 7. Using IM internal SVG rendering I get your bad result. But when I use it with Inkscape (v0.48) I get the good result.

As a general rule, Inkscape works better than IM's internal rendering.
snibgo's IM pages: im.snibgo.com
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Imagemagick svg to jpg removes space when using åäö

Post by eleison »

snibgo wrote:I use IM v6.8.7-0 on Windows 7. Using IM internal SVG rendering I get your bad result. But when I use it with Inkscape (v0.48) I get the good result.

As a general rule, Inkscape works better than IM's internal rendering.

Thank you for letting me know! I was about to install newer version... Hum then I need to figure out how i call Inkscape through my PHP...
Gotta get some sleep now, be back tomorrow! Thanks
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Imagemagick svg to jpg removes space when using åäö

Post by glennrp »

fmw42 wrote: It would appear that you have no delegates. You would certainly need the jpeg delegate installed to create a jpg output. Also you would be better off using either RSVG or Inkscape delegates for dealing with the svg data rather than IM internal one which I think also needs XML delegate.
IM-6.8.0 didn't print a list of delegates (see magick/version.c). Obviously it was able to create jpeg output. The suggestion to use a different SVG renderer is a good one.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick svg to jpg removes space when using åäö

Post by fmw42 »

Hum then I need to figure out how i call Inkscape through
I do not know if Inkscape is listed as a delegate. But IM needs to know it is there. You can tell by

convert -list format

look at the line for SVG and see which delegate it is using.

I am not using Inkscape, so mine shows RSVG


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.36.4)

If yours shows MSVG or XML, then you are using the IM internal renderer and need to install Inkscape where IM can find it.

I am a Mac user, but one of the windows users can tell you how to install it and link it to IM.
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Imagemagick svg to jpg removes space when using åäö

Post by eleison »

fmw42 wrote:
I do not know if Inkscape is listed as a delegate. But IM needs to know it is there. You can tell by

convert -list format

look at the line for SVG and see which delegate it is using.

I am not using Inkscape, so mine shows RSVG


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.36.4)

If yours shows MSVG or XML, then you are using the IM internal renderer and need to install Inkscape where IM can find it.

I am a Mac user, but one of the windows users can tell you how to install it and link it to IM.
SVG SVG rw+ Scalable Vector Graphics (XML 2.9.0)

Can I link IM with Inkscape? That sounds like good news!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick svg to jpg removes space when using åäö

Post by fmw42 »

You are using the IM internal renderer for svg which is indicated by XML.

I cannot help on Windows. But one of the others can.

I typically install all my delegates first and then install IM from source on my unix/Mac.

But Windows may be operate differently for delegates. So wait for one of the Windows users to help.
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Imagemagick svg to jpg removes space when using åäö

Post by eleison »

fmw42 wrote:You are using the IM internal renderer for svg which is indicated by XML.

I cannot help on Windows. But one of the others can.

I typically install all my delegates first and then install IM from source on my unix/Mac.

But Windows may be operate differently for delegates. So wait for one of the Windows users to help.
The SVG convert turns out correct when you converting? If it does i'm going to sleep well tonight ><
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick svg to jpg removes space when using åäö

Post by fmw42 »

I do not have Inkscape, but using RSVG, it works fine for me in IM 6.8.7.9 Q16 Mac OSX
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Imagemagick svg to jpg removes space when using åäö

Post by dlemstra »

I am planning to integrate librsvg in the windows build and make that the default instead of the internal svg handler. I hope I can spend some time on that this weekend.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
eleison
Posts: 45
Joined: 2013-12-10T15:14:46-07:00
Authentication code: 6789

Re: Imagemagick svg to jpg removes space when using åäö

Post by eleison »

dlemstra wrote:I am planning to integrate librsvg in the windows build and make that the default instead of the internal svg handler. I hope I can spend some time on that this weekend.
Thank you! I use windows as my test environment for a php function I'm building. I'm not sure what kind of imagemagick build i will use on the final server. What kind of server and platform should i look for?

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

Re: Imagemagick svg to jpg removes space when using åäö

Post by snibgo »

You might want to try it with Inkscape. For normal use in Windows:

1. Download Inkscape from http://inkscape.org/en/download/?lang=en and install.
2. Put the Inkscape directory in the system path. (eg "set PATH={inkscape's directory};%PATH%".)
3. IM will now use Inkscape. Check this by converting a SVG file to PNG with "-verbose". It should give the Inkscape command, and should not say MSVG or RSVG.

I don't use PHP, and don't know how to tell PHP to search for files in a given path. The easiest way may be to modify delegates.xml, giving the full path to inkscape.exe.
snibgo's IM pages: im.snibgo.com
Post Reply