Page 1 of 1
Error reading SVG file due to rights
Posted: 2017-11-09T12:39:53-07:00
by uigrad
I have a server script that uses Imagemagick for processing SVG images, and I use MSVG for interpreting it. Until recently this has always worked:
Code: Select all
convert +antialias -density 100x100 MSVG:orig.svg output.png
Now, I get:
Code: Select all
stitching: not authorized `/tmp/magick-82738sMRaAneTAQdM' @ error/constitute.c/ReadImage/412.
stitching: no images defined `output.png' @ error/convert.c/ConvertImageCommand/3257.
A bit of searching tells me it is due to security policy stuff. If I type "convert -list policy", I get:
Code: Select all
Path: /usr/local/etc/ImageMagick-6/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: None
pattern: URL
Policy: Coder
rights: None
pattern: HTTPS
Policy: Coder
rights: None
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
Path: [built-in]
Policy: Undefined
rights: None
That .xml file is not something that I can modify without administrator privileges (which I do not have), and I see nothing in the policy about SVG or MSVG. What do I need to do to get this to work again?
Re: Error reading SVG file due to rights
Posted: 2017-11-09T12:48:41-07:00
by magick
Your instance of ImageMagick likely utilizes the internal SVG render which converts SVG to MVG to render it-- and the policy prevents that. Your choices are to get the administrator to install inkscape so ImageMagick uses that for rendering SVG, modify the policy to permit MVG, or install ImageMagick in your user account where you can define your own security policy.
Re: Error reading SVG file due to rights
Posted: 2017-11-09T13:06:48-07:00
by fmw42
You could also have your administrator install RSVG and recompile ImageMagick. But Inkscape is often better than RSVG and both are better than MVG. I do not believe that a recompile is needed for Inkscape. ImageMagick will use it if it finds it on your system.
Re: Error reading SVG file due to rights
Posted: 2017-11-09T14:32:23-07:00
by uigrad
Unfortunately, I must use MSVG, because there is no way to turn off anti-aliasing for batch renders with Inkscape. I had a previous post about it here:
viewtopic.php?f=1&t=26449&p=116373
Is there any way that I can override the policy by adding another command line argument?
I just tried using Inkscape again. I gave the +antialias argument, and it went from having 5 colors to 990. That is unacceptable. :/
Re: Error reading SVG file due to rights
Posted: 2017-11-09T15:14:16-07:00
by uigrad
I found
this thread that suggests that policy files can be placed in other locations. Using the method there, I discovered that /home/private/.magick/ is a place that it searched for policy files. So, I copied policy.xml there, changed "none" to "read" for MVG, and now when I query convert -list policy, I get both locations, but the system default location is first:
Code: Select all
% convert -list policy
Path: /usr/local/etc/ImageMagick-6/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: None
pattern: URL
Policy: Coder
rights: None
pattern: HTTPS
Policy: Coder
rights: None
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
Path: /home/private//.magick/policy.xml
Policy: Coder
rights: None
pattern: EPHEMERAL
Policy: Coder
rights: None
pattern: URL
Policy: Coder
rights: None
pattern: HTTPS
Policy: Coder
rights: Read
pattern: MVG
Policy: Coder
rights: None
pattern: MSL
Path: [built-in]
Policy: Undefined
rights: None
I tried my SVG to PNG operation again, and it still failed. Does this mean I can't override the system default?
Re: Error reading SVG file due to rights
Posted: 2017-11-09T15:37:40-07:00
by snibgo
uigrad wrote:Does this mean I can't override the system default?
Correct. Personal policy files can only add rules. Users can tighten security, but can't loosen it. If they (we) could, it wouldn't be security.
Re: Error reading SVG file due to rights
Posted: 2017-11-09T16:00:50-07:00
by uigrad
magick wrote: ↑2017-11-09T12:48:41-07:00 or install ImageMagick in your user account where you can define your own security policy.
I've tried doing this. The system is BSD, but ./configure --prefix=home/private/bin seemed to work just fine.
make ran a really long time. It generated the same warning from timeb.h over and over. Finally, it failed in _la-wand-view.lo, I think:
Code: Select all
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated" [-Wcpp]
#warning "this file includes <sys/timeb.h> which is deprecated"
^
CCLD MagickWand/libMagickWand-7.Q16HDRI.la
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Blob.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-BlobRef.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-CoderInfo.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Color.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Drawable.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Exception.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Functions.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Geometry.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Image.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-ImageRef.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Montage.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Options.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Pixels.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-ResourceLimits.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Statistic.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-STL.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-Thread.lo
CXX Magick++/lib/Magick___lib_libMagick___7_Q16HDRI_la-TypeMetric.lo
CXXLD Magick++/lib/libMagick++-7.Q16HDRI.la
CC utilities/magick.o
In file included from ./MagickWand/studio.h:173:0,
from utilities/magick.c:44:
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated" [-Wcpp]
#warning "this file includes <sys/timeb.h> which is deprecated"
^
CCLD utilities/magick
make[1]: don't know how to make MagickCore/ImageMagick-7.Q16HDRI.pc. Stop
make[1]: stopped in /home/private/install/ImageMagick-7.0.7-10
*** Error code 2
Stop.
make: stopped in /home/private/install/ImageMagick-7.0.7-10