Home > Article > Backend Development > Why Does ImageMagick Report \'Not Authorized to Convert PDF to Image\' and How Can I Fix It?
ImageMagick: Resolving Error "Not Authorized to Convert PDF to Image"
The error "ImageMagick not authorized to convert PDF to an image" can occur when the system lacks necessary permissions to access the PDF file. This issue is encountered when using ImageMagick to convert PDFs to images through the subprocess package.
Specifically, the error message "convert-im6.q16: not authorized `temp2.pdf' @ error/constitute.c/ReadImage/412" indicates that ImageMagick does not have the necessary permissions to read the PDF file.
To resolve this error on a Linux server, follow these steps:
Edit ImageMagick's Policy XML File:
Locate and open the ImageMagick policy.xml file, typically found in /etc/ImageMagick-6/policy.xml.
Uncomment the Policy Line:
Find the following line in the policy.xml file, which may be commented out with '--':
Change Rights to "Read|Write":
Change the "rights" attribute from "none" to "read|write":
Save and Restart:
Save the policy.xml file and restart ImageMagick to apply the changes.
This modification allows ImageMagick to access and read PDF files, resolving the authorization issue during PDF to image conversion.
The above is the detailed content of Why Does ImageMagick Report \'Not Authorized to Convert PDF to Image\' and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!