ILD

compile libheif & libvips
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2026-2-4 站点:Inside Linux Development

vips可以用来处理图片、生成缩略图等,使用广泛。libheif用来解析heic图片等。


libheif使用的decoder,是:

https://github.com/strukturag/libde265


编译libde265

$ cat Makefile
TOPDIR := $(CURDIR)

config:
        mkdir -p build
        cd build && cmake -DCMAKE_INSTALL_PREFIX=$(TOPDIR)/staging ..

compile:
        cd build && make

install:
        cd build && make install

clean:
        rm -fr build staging


编译libheif

https://github.com/strukturag/libheif

需要pkg-config指定libde265的路径

$ cat Makefile
TOPDIR := $(CURDIR)

export PKG_CONFIG_PATH := /home/yuan/nas/libde265/staging/lib64/pkgconfig

config:
        mkdir -p build
        cd build && cmake --preset=release -DCMAKE_INSTALL_PREFIX=$(TOPDIR)/staging ..

compile:
        cd build && make

install:
        cd build && make install

clean:
        rm -fr build staging


编译libvips

https://github.com/libvips/libvips.git

$ cat Makefile

TOPDIR := $(CURDIR)

export PKG_CONFIG_PATH := /home/yuan/nas/libheif/staging/lib64/pkgconfig

config:
        meson setup build --prefix $(TOPDIR)/staging \
                -Dheif=enabled

compile:
        cd build && meson compile

install:
        cd build && meson install

clean:
        rm -fr build


运行:LD_LIBRARY_PATH=/home/yuan/nas/libvips/staging/lib64:/home/yuan/nas/libheif/staging/lib64/:/home/yuan/nas/libde265/staging/lib64/ ./vipsthumbnail ~/DSC02338.HIF

Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.