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"/>
相关推荐
打码人的日常分享16 分钟前
运维服务方案,运维巡检方案,运维安全保障方案文件
大数据·运维·安全·word·安全架构
荣光波比1 小时前
Nginx 实战系列(一)—— Web 核心概念、HTTP/HTTPS协议 与 Nginx 安装
linux·运维·服务器·nginx·云计算
武文斌771 小时前
单片机:DS18B20测温度、74HC595扩展芯片、8*8LED矩阵
运维·服务器·单片机·嵌入式硬件
fengfuyao9851 小时前
诊断并修复SSH连接Github时遇到的“connection closed“错误
运维·ssh·github
scugxl2 小时前
centos7 docker离线安装
运维·docker·容器
阿sir1982 小时前
ZYNQ 自定义IP
服务器·网络·tcp/ip
绿箭柠檬茶3 小时前
Ubuntu 使用 Samba 共享文件夹
linux·运维·ubuntu
工藤新一¹4 小时前
Linux —— 虚拟进程地址空间
linux·运维·服务器·c/c++·虚拟进程地址空间
Aspiresky5 小时前
浅析Linux内核scatter-gather list实现
linux·dma·scatter/gather
奔跑吧 android5 小时前
【linux kernel 常用数据结构和设计模式】【数据结构 3】【模拟input子系统input_dev和input_handler之间的多对多关系】
linux·数据结构·input·kernel·input_dev·input_handler·input_handle