https://docker.dovov.com/4792/docker-alpineimagemagick.html
Debian/Ubuntu:
sudo apt-get install imagemagick
CentOS/Fedora:
sudo dnf install ImageMagick
#权限报错处理
修改安全文件
vim /etc/ImageMagick-6/policy.xml
添加读写权限
<policy domain="coder" rights="read|write" pattern="PDF" />
convert -density 300 input.pdf output.jpg
-density参数用于设置生成的图像的分辨率
#安装imageMagick
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
&& apt update \
&& apt-get install imagemagick -y \
&& sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read|write" pattern="PDF"/g' /etc/ImageMagick-6/policy.xml