Ubuntu 编译安装 ImageMagick 来处理图片

一:克隆 ImageMagick

复制代码
cd /tools
git clone https://github.com/ImageMagick/ImageMagick.git
cd ImageMagick

二:安装编译 ImageMagick 所需的软件包

复制代码
sudo apt -y install build-essential libltdl-dev libjpeg-dev libpng-dev libtiff-dev libgif-dev libfreetype6-dev liblcms2-dev libxml2-dev

./configure --prefix=/apps/ImageMagick --enable-shared --enable-static --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes

make
make install

cat >> /etc/profile <<EOF
export ImageMagick_HOME=/apps/ImageMagick
export PATH=\$PATH:\$ImageMagick_HOME/bin


EOF
source /etc/profile


#查看支持的图片格式
magick -list format

# 查看生效
magick --version

参考ImageMagick命令: 使用 ImageMagick 命令行工具处理图像指南 - DEV Community

复制代码
magick identify tiger.jpg

添加中文字体

将 C:\Windows\Fonts\中的 simkai.ttf simsun.ttc 拷贝到 ubuntu的 /apps/fonts目录下

编辑 /apps/ImageMagick/etc/ImageMagick-7/type-ghostscript.xml

添加如下

复制代码
  <type name="SimSun" fullname="SimSun" family="SimSun & NSimSun" foundry="URW" weight="400" style="normal" stretch="normal" format="ttf" metrics="/apps/fonts/simsun.ttc" glyphs="/apps/fonts/simsun.ttc"/>
  <type name="SimKai" fullname="SimKai" family="SimKai" foundry="URW" weight="400" style="normal" stretch="normal" format="ttf" metrics="/apps/fonts/simkai.ttf" glyphs="/apps/fonts/simkai.ttf"/>
相关推荐
winner888129 分钟前
Linux 软件安装 “命令密码本”:yum/apt/brew 一网打尽
linux·运维·服务器
九河云1 小时前
软件开发平台 DevCloud
运维·服务器·数据库·科技·华为云
firstacui1 小时前
DNS高速缓存&分离解析
服务器
思麟呀2 小时前
Linux的基础IO流
linux·运维·服务器·开发语言·c++
winner88813 小时前
嵌入式Linux驱动开发全流程:工具协作+核心概念拆解(从入门到理解)
linux·运维·驱动开发
ShiinaKaze3 小时前
fatal error: bits/c++config.h: No such file or directory
linux·gcc·g++
TTBIGDATA3 小时前
【Ambari开启Kerberos】KERBEROS SERVICE CHECK 报错
大数据·运维·hadoop·ambari·cdh·bigtop·ttbigdata
Archy_Wang_13 小时前
脚本自动生成专业Linux巡检报告
linux·运维·服务器
java_logo3 小时前
SGLANG Docker容器化部署指南
linux·运维·docker·容器·eureka·1024程序员节
Qayrup4 小时前
各个系统的 docker安装
运维·docker·容器