What causes this problem and how can I fix it? I did some research but couldn't find anything about this particular problem.
asked Mar 20, 2019 at 14:52 763 1 1 gold badge 5 5 silver badges 4 4 bronze badgesImageMagick has some security policies disabling some rights for security reasons. See why at the bottom of this answer.
You will have to edit a config file to re-enble the action you need.
Open /etc/ImageMagick-6/policy.xml with your favorite text editor, find the line and replace "none" by "read|write"
# Open the file sudo nano /etc/ImageMagick-6/policy.xml # find and edit the line # to :
About ImageMagick security policy
The restricted policy is made to prevent unknown vulnerabilities coming from third party software as Ghostscript used here for PDF files. Be sure to update Ghostscript.
For anyone who winds up here, I recommend looking at the question this has been marked as a duplicate of. You really don't want to relax ImageMagick's security policy when there are alternatives that are both safer and more lossless than asking ImageMagick to decode JPEGs and then re-encode them as part of making a PDF.
Commented Feb 16, 2020 at 3:34@Sqerstet :have you red the imagemagick documentation about security policy.xml ? No. ImageMagick thinks there is a security issue. Nope, they do not. The restricted policy is made to prevent unknown vulnerabilities coming from third party software as Ghostscript used here for PDF files. If Ghostscript is up to date, then no (known) issue. Have a nice day and please, read, read, read
Commented Jun 8, 2020 at 15:24Since you chose to only read the first sentence, I have deleted it because it changes nothing. You are recommending users to disable settings which were set "for security reasons" (your words), without even explaining the implications. Sorry, but that is irresponsible.
Commented Jun 9, 2020 at 5:01If I know I'm only going to process my own files, generated by my own scripts, I feel it is safe to disable the blockings. Is there a way to have multiple policies?
Commented Jul 26, 2020 at 19:38Additional info: be sure, you have installed GhostScript >= 9.26. After that you can play around with policy.xml suse.com/support/kb/doc/?id=000019384
Commented Mar 17, 2021 at 7:36Because of a known bug with security implications, the conversion to pdf is disabled in ImageMagick convert .
I suggest that you work around the problem,
sudo apt install img2pdf
and run the following command line to create a pdf file with several pictures corresponding to the question or something similar for other cases,
img2pdf --output out.pdf Blatt1.jpg Blatt2.jpg Blatt3.jpg Blatt4.jpg
Edit: There is a solution now, ghostscript is new enough in my computers, and I think in most up to date Linux operating systems:
Additional info: be sure, you have installed GhostScript >= 9.26. After that you can play around with policy.xml https://suse.com/support/kb/doc/?id=000019384:
So we can do the edits in the accepted answer and start using ghostscript again to convert to pdf with ImageMagick convert .
answered Mar 20, 2019 at 14:57 46.9k 5 5 gold badges 93 93 silver badges 154 154 bronze badgesDownvoted for suggesting an interactive replacement for a batch command which could easily have been excerpted from a larger script.
Commented Feb 15, 2020 at 9:36Upvoted for not recommending people to break default security settings. Another option here: askubuntu.com/a/1210721/304983
Commented Jun 8, 2020 at 15:49@Sqerstet these default security settings are utterly irrelevant for most users. That's not to say they're useless: for those few users who run ImageMagick in some web service, it is a severe security issue, so the developers were certainly right to disable this just to enforce fixing the issue. But for anybody else who just uses ImageMagick with PDFs they have complete control over, it is much more sensible to re-enable it than to switch to a completely different tool, certainly one as badly suited for the task as LibreOffice. (Though, the only proper solution is to fix GhostScript. )
Commented May 18, 2021 at 10:34@leftaroundabout You are almost certainly right but that's not the point. Recommending that people break default security settings is a terrible idea. As you say, the solution is to fix the problem. Or use alternatives, because apparently ImageMagick cannot properly maintain its software. The alternative I recommended was not LibreOffice.