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"/>
相关推荐
cqsztech3 小时前
oracle linux 10 +pg18 源码安装要点
linux·数据库·oracle
奥尔特星云大使3 小时前
ALTER 与 UPDATE、DROP 与 DELETE区别
linux·运维·数据库·mysql
野犬寒鸦3 小时前
多级缓存架构:性能与数据一致性的平衡处理(原理及优势详解+项目实战)
java·服务器·redis·后端·缓存
duangww4 小时前
部署sapui5应用到linux
linux·sap fiori
siriuuus4 小时前
Linux ssh/scp/sftp命令使用及免密登录配置
linux·ssh·sftp·scp
2025年一定要上岸4 小时前
【日常学习】UI自动化自定义异常类
运维·ui·自动化
海琴烟Sunshine6 小时前
Leetcode 14. 最长公共前缀
java·服务器·leetcode
teacher伟大光荣且正确6 小时前
Linux 下编译openssl
linux·运维·服务器
dlz08366 小时前
--group-start/--group-end 能不能解决 OpenSSL 1.0 vs 1.1 的优先级问题?
linux·运维·服务器·软件需求
龙茶清欢7 小时前
5、urbane-commerce 微服务统一依赖版本管理规范
java·运维·微服务