centos7 编译安装imagemagick7.1
参考
https://blog.csdn.net/chen_cong_520/article/details/134638717
#cd /usr/local #wget https://www.nasm.us/pub/nasm/releasebuilds/2.16/nasm-2.16.tar.gz #tar -zxvf nasm-2.16.tar.gz #cd nasm-2.16 #./autogen.sh && ./configure && make && make install #cd ../ #pwd #wget https://github.com/strukturag/libheif/releases/download/v1.15.2/libheif-1.15.2.tar.gz #tar -zxvf libheif-1.15.2.tar.gz #cd libheif-1.15.2 #./autogen.sh && ./configure && make && make install #PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig #export PKG_CONFIG_PATH #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64 #export LD_LIBRARY_PATH #heif-info #cd ../ #wget https://imagemagick.org/archive/ImageMagick-7.1.1-29.tar.gz #tar -zxvf ImageMagick-7.1.1-29.tar.gz #cd ImageMagick-7.1.1-29 #yum install -y libwebp-tools #./configure --prefix=/usr/local/imagemagick && make && make install #convert -version #rm /usr/bin/convert #ln -s /usr/local/imagemagick/bin/magick /usr/bin/convert #convert -version #convert -list format
convert -list format命令查看支持的格式里面有HEIF、HEIC等苹果ios支持的图片格式
下面两行要写到/etc/profile中
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
export LD_LIBRARY_PATH
写好后
#source /etc/profile
[root@192 ~]# cd /data/wwwroot/imgtest
把png图片转换成webp图片格式
[root@192 imgtest]# cwebp semi_transparent2.png -o semi_transparent2.webp
二:安装php7的imagick扩展
# wget https://pecl.php.net/get/imagick-3.7.0.tgz # tar xvf imagick-3.7.0.tgz # cd imagick-3.7.0 # /usr/local/php7.4/bin/phpize # ./configure --with-php-config=/usr/local/php7.4/bin/php-config --with-imagick=/usr/local/imagemagick # make && make install # vi /usr/local/php7.4/etc/php.ini # 添加一段 extension=/usr/local/php7.4/lib/php/extensions/no-debug-non-zts-20190902/imagick.so
#/etc/init.d/php-fpm restart