convert:not authorized `aaaa` @ error/constitute.c/ReadImage/453

后端 未结 11 2250
无人及你
无人及你 2020-11-27 08:50

I want to create a captcha pic by use convert from ImageMagick.

And I follow this, but there are some problem .

Input In my linux shell:

相关标签:
11条回答
  • 2020-11-27 09:40

    Note: the solution in this and other answers involves disabling safety measures that are there to fix arbitrary code execution vulnerabilities. See for instance this ghostscript-related and this ubuntu-related announcement. Only go forward with these solutions if the input to convert comes from a trusted source.

    I use ImageMagick in php (v.7.1) to slice PDF file to images.

    First I got errors like:

    Exception type: ImagickException

    Exception message: not authorized ..... @ error/constitute.c/ReadImage/412

    After some changes in /etc/ImageMagick-6/policy.xml I start getting erroes like:

    Exception type: ImagickException

    Exception message: unable to create temporary file ..... Permission denied @ error/pdf.c/ReadPDFImage/465

    My fix:

    In file /etc/ImageMagick-6/policy.xml (or /etc/ImageMagick/policy.xml)

    1. comment line

      <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
      
    2. change line

      <policy domain="coder" rights="none" pattern="PDF" />
      

      to

      <policy domain="coder" rights="read|write" pattern="PDF" />
      
    3. add line

      <policy domain="coder" rights="read|write" pattern="LABEL" />
      

    Then restart your web server (nginx, apache).

    0 讨论(0)
  • 2020-11-27 09:42

    I had this error when trying to convert a pdf to jpg and solved it using this method: sudo vi /etc/ImageMagick*/policy.xml

    change:

    policy domain="coder" rights="none" pattern="PDF"

    to:

    policy domain="coder" rights="read|write" pattern="PDF"

    Source: http://realtechtalk.com/ImageMagick_Convert_PDF_Not_Authorized-2217-articles

    0 讨论(0)
  • 2020-11-27 09:43

    Just delete /etc/ImageMagick/policy.xml file. E.g.

    rm /etc/<ImageMagick_PATH>/policy.xml
    

    For ImageMagick 6, it's:

    sudo rm /etc/ImageMagick-6/policy.xml
    
    0 讨论(0)
  • 2020-11-27 09:44

    After a recent update on my Ubuntu 16.04 system I have also started getting this error when trying to run convert on .ps files to convert them into pdfs.

    This fix worked for me:

    In a terminal run:

    sudo gedit /etc/ImageMagick-6/policy.xml
    

    This should open the policy.xml file in the gedit text editor. If it doesn't, your image magick might be installed in a different place. Then change

    rights="none" 
    

    to

    rights="read | write" 
    

    for PDF, EPS and PS lines near the bottom of the file. Save and exit, and image magick should then work again.

    0 讨论(0)
  • 2020-11-27 09:46

    I also had the error error/constitute.c/ReadImage/453 when trying to convert an eps to a gif with image magick. I tried the solution proposed by sNICkerssss but still had errors (though different from the first one)e error/constitute.c/ReadImage/412 What solved the problem was to put read to other entries

     <policy domain="coder" rights="read" pattern="PS" />
     <policy domain="coder" rights="read" pattern="EPS" />
     <policy domain="coder" rights="read" pattern="PDF" />
     <policy domain="coder" rights="read" pattern="XPS" />
     <policy domain="coder" rights="read|write" pattern="LABEL" />
    
    0 讨论(0)
提交回复
热议问题