![]() If, for some reason, you can't do that (eg. This should be the equivalent command: img2pdf -out myfile.pdf /home/bill/TempScan/*.png not be fast because input data gets re-encodedĪnother advantage of not having to re-encode the input (in most common situations) is, that img2pdf is able to handle much larger input than other software, because the raw pixel data never has to be loaded into memory.not be small because using wasteful flate encoding of raw pixel data.not be lossless because lossy re-encoding to JPEG.fast: if possible, the input image is just pasted into the PDF document as-is without any CPU hungry re-encoding of the pixel dataĬonventional conversion software (like ImageMagick) would either:.small: if possible, the difference in filesize between the input image and the output PDF will only be the overhead of the PDF container itself.always lossless: the image embedded in the PDF will always have the exact same color information for every pixel as the input.You should use img2pdf if your priorities are (in this order): It's specifically designed for this kind of use-case. Rather than re-loosening ImageMagick's security restrictions, I'd just use img2pdf. If you do not want to eliminate all security policies, this is the way to go. Sudo mv /etc/ImageMagick-6/policy.xmlout /etc/ImageMagick-6/policy.xmlīe well aware that moving the policy file out decreases system security.Įliminating only the restriction to combine into PDFįor your specific case, gene_wood in a comment pointed to the posibility to selectively relax the policy for working with PDF files by commenting out one line:Įdit the file, and place comment marks around this line to disable this rule: To revert to the original situation, just rename back to the original name: Sudo mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xmlout As a result, all policies are lifted, but you still can revert if needed: With this command, you are renaming the file. To that aim, one may delete the file, but it is better practice to "move the file out" by renaming it. You may edit that file as root user to change the policies.įor desktop users not running a webserver, simply eliminating these restrictions might be good enough. The policy file is /etc/ImageMagick-6/policy.xml. While Ghostscript versions are updated to secure versions in all supported Ubuntu versions (at this time from Ubuntu 16.04 onwards), the usage restriction may still be in place. The issue has been fixed since Ghostscript version 9.24. Because of a significant security hole in Ghostscript prior to version 9.24, use of convert on PDF files has been blocked as a stopgap. Its support for PDF is provided by Ghostscript. Convert is a powerful command line tool to convert graphics.
0 Comments
Leave a Reply. |