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"/>
相关推荐
大小科圣3 分钟前
lnmp平台
运维·服务器·nginx
听风吹等浪起7 分钟前
计算机网络基础:IIS服务器(WEB服务器)
运维·服务器·计算机网络
seu他山之石38 分钟前
插爆区域引小buf搬出去
linux·ic
niuTaylor1 小时前
【Linux和RTOS简析】
linux·运维·服务器·macos·macbook air·换硬盘·扩内存
什么半岛铁盒1 小时前
【Linux系统】进程状态:一个进程的轮回史
linux·服务器·编辑器
落——枫1 小时前
操作系统知识点23
linux·运维·服务器
誓约酱1 小时前
(每日一题) 力扣 860 柠檬水找零
linux·c语言·c++·算法·leetcode·职场和发展
学编程的小程1 小时前
无公网IP也能远程控制Windows:Linux rdesktop内网穿透实战
linux·windows·tcp/ip
Arbori_262151 小时前
linux 命令sed
linux·运维·服务器
ZhifeiDlut1 小时前
ubuntu 安装 Zotero
linux·ubuntu·zotero