Converting SVG to PNG on QNAP fails

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
DazDavid
Posts: 6
Joined: 2019-10-13T18:25:47+00:00
Authentication code: 1152

Converting SVG to PNG on QNAP fails

Post by DazDavid »

Hi@All,

I´m trying since quite a while to fix a problem I´m having when I want to convert a SVG File to a PNG using Imagemagick.
In the past it worked without any Problem on a Raspberry Pi but last year I switched for some reasons to a QNAP NAS and there I have trouble with ImageMagick.

ImageMagick 6.9.4-8 Q16 was preinstalled but I tested some further Versions (using Entware and QNAP Packages) with a similar Result.

Following the Output with -debug all Option. My Assumption is, that the TMP-Files are not being created, I just don´t know why.
TEMP Directory is set to default in policy.xml (/tmp).

Code: Select all

[/etc/config/ImageMagick-6] # convert -debug all /opt/fhem/www/images/Kindle_Status.svg -type GrayScale -depth 8
2019-10-13T20:22:31+02:00 0:00.000 0.000u 6.9.4 Configure convert[29010]: utility.c/ExpandFilenames/940/Configure
  Command line: convert {-debug} {all} {/opt/fhem/www/images/Kindle_Status.svg} {-type} {GrayScale} {-depth} {8}
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Policy convert[29010]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Path; rights=Read; pattern="/opt/fhem/www/images/Kindle_Status.svg" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Blob convert[29010]: blob.c/OpenBlob/2597/Blob
    read 3 magic header bytes
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Cache convert[29010]: cache.c/DestroyPixelCache/1214/Cache
  destroy
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/ImageMagick-6/magic.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/lib/ImageMagick-6.9.4//config-Q16/magic.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/etc/config/ImageMagick-6/magic.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/doc/ImageMagick-6/magic.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.config/ImageMagick/magic.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.magick/magic.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: magic.c/LoadMagicCache/792/Configure
  Loading magic configure file "/etc/config/ImageMagick-6/magic.xml" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Policy convert[29010]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Coder; rights=Read; pattern="SVG" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/ImageMagick-6/delegates.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/lib/ImageMagick-6.9.4//config-Q16/delegates.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/etc/config/ImageMagick-6/delegates.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/doc/ImageMagick-6/delegates.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.config/ImageMagick/delegates.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.magick/delegates.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: delegate.c/LoadDelegateCache/2087/Configure
  Loading delegate configuration file "/etc/config/ImageMagick-6/delegates.xml" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Policy convert[29010]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Delegate; rights=Execute; pattern="SVG" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Policy convert[29010]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Delegate; rights=Execute; pattern="(null)" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/502/Resource
  ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/553/Resource
  Acquire magick-29010J43Pj-zsMmXL
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/502/Resource
  ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/553/Resource
  Acquire magick-29010mNMwXijRxlSf
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010mNMwXijRxlSf
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010mNMwXijRxlSf.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/502/Resource
  ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/553/Resource
  Acquire magick-290105w_59aj0ZlNJ
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/502/Resource
  ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/553/Resource
  Acquire magick-29010GyQzzTzp8mId
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/502/Resource
  ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/AcquireUniqueFileResource/553/Resource
  Acquire magick-29010IeUauwz0YoDH
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010IeUauwz0YoDH
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010IeUauwz0YoDH.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Policy convert[29010]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Delegate; rights=Execute; pattern="rsvg-convert" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010J43Pj-zsMmXL
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010J43Pj-zsMmXL.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010mNMwXijRxlSf
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010mNMwXijRxlSf.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-290105w_59aj0ZlNJ
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-290105w_59aj0ZlNJ.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010GyQzzTzp8mId
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010GyQzzTzp8mId.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010mNMwXijRxlSf
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010mNMwXijRxlSf.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010mNMwXijRxlSf
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Resource convert[29010]: resource.c/RelinquishUniqueFileResource/1042/Resource
  Relinquish magick-29010IeUauwz0YoDH
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: utility.c/ShredFile/1822/Exception
  Failed to remove: magick-29010IeUauwz0YoDH.cache
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/ImageMagick-6/locale.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/lib/ImageMagick-6.9.4//config-Q16/locale.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/etc/config/ImageMagick-6/locale.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/doc/ImageMagick-6/locale.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/.config/ImageMagick/locale.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/.magick/locale.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: locale.c/LoadLocaleCache/1179/Configure
  Loading locale configure file "/etc/config/ImageMagick-6/locale.xml" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/ImageMagick-6/english.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/lib/ImageMagick-6.9.4//config-Q16/english.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/etc/config/ImageMagick-6/english.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/daily_build/64_10/4.3.5/LinkFS/usr/share/doc/ImageMagick-6/english.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/.config/ImageMagick/english.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Locale convert[29010]: locale.c/GetLocaleOptions/825/Locale
  Searching for locale file: "/root/.magick/english.xml"
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Configure convert[29010]: locale.c/LoadLocaleCache/1179/Configure
  Loading locale configure file "/etc/config/ImageMagick-6/english.xml" ...
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Exception convert[29010]: delegate.c/InvokeDelegate/1919/Exception
  delegate failed `'rsvg-convert' -o '%o' '%i''
2019-10-13T20:22:31+02:00 0:00.010 0.000u 6.9.4 Cache convert[29010]: cache.c/DestroyPixelCache/1214/Cache
  destroy
2019-10-13T20:22:31+02:00 0:00.020 0.000u 6.9.4 Exception convert[29010]: constitute.c/ReadImage/544/Exception
  unable to open file `magick-29010J43Pj-zsMmXL': No such file or directory
2019-10-13T20:22:31+02:00 0:00.020 0.000u 6.9.4 Exception convert[29010]: convert.c/ConvertImageCommand/3254/Exception
  missing an image filename `8'
convert: delegate failed `'rsvg-convert' -o '%o' '%i'' @ error/delegate.c/InvokeDelegate/1919.
convert: unable to open file `magick-29010J43Pj-zsMmXL': No such file or directory @ error/constitute.c/ReadImage/544.
convert: missing an image filename `8' @ error/convert.c/ConvertImageCommand/3254.
I hope anybody has a hint for me where to look or what to change.
Thanks in Advance for any advices.

Regards
David
Last edited by DazDavid on 2019-10-13T19:20:18+00:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-03T00:14:51+00:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting SVG to PNG on QNAP fails

Post by fmw42 »

Your first line
[/etc/config/ImageMagick-6] # convert -debug all /opt/fhem/www/images/Kindle_Status.svg -type GrayScale -depth 8
Seems to be missing an output. It also looks like you are trying to convert an SVG to PNG and not PNG to SVG. Please clarify.

Perhaps post your exact command line. The line above may have been cut off.

Is RSVG delegate installed with Imagemagick? What do you get from

Code: Select all

convert -version
snibgo
Posts: 12159
Joined: 2010-01-24T06:01:33+00:00
Authentication code: 1151
Location: England, UK

Re: Converting SVG to PNG on QNAP fails

Post by snibgo »

DazDavid wrote:delegate failed `'rsvg-convert' -o '%o' '%i''
Is rsvg-convert installed? If not, then that's the problem.

In addition, your command has no output filename.
snibgo's IM pages: im.snibgo.com
DazDavid
Posts: 6
Joined: 2019-10-13T18:25:47+00:00
Authentication code: 1152

Re: Converting SVG to PNG on QNAP fails

Post by DazDavid »

Thanks, I recognized that with the missing Output File. Indeed I try to convert an SVG to PNG.
The full command Line is:

Code: Select all

convert -debug all /opt/fhem/www/images/Kindle_Status.svg -type GrayScale -depth 8 /opt/fhem/www/images/Kindle_Status.png
Also you seem to be right with rsvg-convert to not being installed right now.
Output of convert -version:

Code: Select all

ersion: ImageMagick 6.9.4-8 Q16 x86_64 2019-09-19 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC
Delegates (built-in): bzlib jng jpeg png tiff
Unfortunately I don´t know how to install rsvg-convert on a QNAP NAS.

EDIT: rsvg seems to be part of librsvg2 which doesn´t seem to exist for QNAP. Any Advice for an alternative or maybe experiences if it is possible to run Imagemagick in a docker container to convert the File?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-03T00:14:51+00:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting SVG to PNG on QNAP fails

Post by fmw42 »

You have two other options. First, Imagemagick has a built in MSVG/XML renderer. You can see that if you do

convert -list format

look at the line for SVG. At the end, it should list MSVG or XML

The other option is just to install Inkscape. Then Imagemagick will use it if it can be found. You do not have to recompile Imagemagick like you would with RSVG.
DazDavid
Posts: 6
Joined: 2019-10-13T18:25:47+00:00
Authentication code: 1152

Re: Converting SVG to PNG on QNAP fails

Post by DazDavid »

Thanks!

MSVG seems to be available:

Code: Select all

MSVG  -w+   ImageMagick's own SVG internal renderer
      SVG  -w+   Scalable Vector Graphics
     SVGZ  -w+   Compressed Scalable Vector Graphics
But how can I use the MSVG renderer instead rsvg?

Regarding Inkscape, I already came across this idea but when I tried it didnt work as well. It looks like Inkscape on QNAP ist not the full package or at least I couldnt find any binaries.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-03T00:14:51+00:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting SVG to PNG on QNAP fails

Post by fmw42 »

It should run automatically when you do

Code: Select all

convert image.svg image.png
But your delegates do not have xml installed.

Can you install Inkscape on the system, which does not work as a delegate. So IM does not need to be reinstalled.
DazDavid
Posts: 6
Joined: 2019-10-13T18:25:47+00:00
Authentication code: 1152

Re: Converting SVG to PNG on QNAP fails

Post by DazDavid »

I installed Inkscape but nothing changed.
DazDavid
Posts: 6
Joined: 2019-10-13T18:25:47+00:00
Authentication code: 1152

Re: Converting SVG to PNG on QNAP fails

Post by DazDavid »

I think im going to to a reinstall of the NAS this week. Maybe I screwed something up during testing.
Sometimes it helps to start over from zero :)
DazDavid
Posts: 6
Joined: 2019-10-13T18:25:47+00:00
Authentication code: 1152

Re: Converting SVG to PNG on QNAP fails

Post by DazDavid »

I give up. Even after reinstalling no success. I think is jsut not possible without a VM or something similar. I will look for another way somehow.
Thanks anyway
User avatar
fmw42
Posts: 25562
Joined: 2007-07-03T00:14:51+00:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting SVG to PNG on QNAP fails

Post by fmw42 »

What version did you install of Imagemagick. IM 6.9.4.8 is very old. Perhaps before Inkscape was being used by IM? Can you upgrade?
Post Reply