linux:安装png的库libpng(rocky linux 9.2)
一,dwebp/cwebp缺少libpng库时的报错:
[root@localhost work]# dwebp a.webp -o a.png
Decoded a.webp. Dimensions: 856 x 300 . Format: lossy. Now saving...
PNG support not compiled. Please install the libpng development package before building.
You can run with -ppm flag to decode in PPM format.
Error writing file a.png !!
二,安装libpng:
1,官方地址:
https://www.linuxfromscratch.org/blfs/view/svn/general/libpng.html
如图:
2,下载:
[root@localhost imagemagick]# wget https://downloads.sourceforge.net/libpng/libpng-1.6.40.tar.xz
解压:
[root@localhost imagemagick]# xz -d libpng-1.6.40.tar.xz
[root@localhost imagemagick]# tar xvf libpng-1.6.40.tar
3,配置:
[root@localhost libpng-1.6.40]# ./configure --prefix=/usr --disable-static
4,编译:
[root@localhost libpng-1.6.40]# make
5,测试
[root@localhost libpng-1.6.40]# make check
6,安装
[root@localhost libpng-1.6.40]# make install
7,安装手册:
[root@localhost libpng-1.6.40]# mkdir -v /usr/share/doc/libpng-1.6.40
mkdir: 已创建目录 '/usr/share/doc/libpng-1.6.40'
[root@localhost libpng-1.6.40]# cp -v README libpng-manual.txt /usr/share/doc/libpng-1.6.40
'README' -> '/usr/share/doc/libpng-1.6.40/README'
'libpng-manual.txt' -> '/usr/share/doc/libpng-1.6.40/libpng-manual.txt’
说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/07/12/linux-an-zhuang-png-de-ku-libpng-rocky-linux-9-2/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
三,测试效果:
webp重新编译安装后再次执行:
[root@localhost work]# dwebp a.webp -o a2.png
Decoded a.webp. Dimensions: 856 x 300 . Format: lossy. Now saving...
Saved file a2.png
四,查看linux的版本:
[root@localhost ImageMagick-7.1.1-12]# cat /etc/redhat-release
Rocky Linux release 9.2 (Blue Onyx)