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

后端 未结 11 2423
无人及你
无人及你 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:32

    If you don't need to handle raster files and PDF/PS/EPS through the same tool, don't loosen ImageMagick's security.

    Instead, keep your defense in depth for your web applications intact, check that your Ghostscript has been patched for all known -dSAFER vulnerabilities and then invoke it directly.

    gs -dSAFER -r300 -sDEVICE=png16m -o document-%03d.png document.pdf
    
    • -dSAFER opts you out of the legacy-compatibility "run Postscript will full permission to interact with the outside world as a turing-complete programming language" mode.
    • -r300 sets the desired DPI to 300 (the default is 72)
    • -sDEVICE specifies the output format (See the Devices section of the manual for other choices.)
    • -o is a shorthand for -dBATCH -dNOPAUSE -sOutputFile=
    • This section of the Ghostscript manual gives some example formats for for multi-file filename output but, for the actual syntax definition, it points you at the documentation for the C printf(3) function.

    If you're rendering EPS files, add -dEPSCrop so it won't pad your output to page size and use -sDEVICE=pngalpha to get transparent backgrounds.

提交回复
热议问题