跳转到主要内容

HEIF图像格式解码器

项目描述

cykooz.heiflibheif-rs 库的简单Python封装。

RawHeifImage 是低级HEIF解码器的一个简单封装。

变更日志

使用示例

从文件读取HEIF图像

from cykooz.heif.image import RawHeifImage

img = RawHeifImage.from_path('data/test.heif')
assert img.width == 3024
assert img.height == 4032
assert img.mode == 'RGB'
assert len(img.data) == 36578304
assert img.stride == 9072
assert len(img.exif) == 2026

从文件-like对象读取HEIF图像

from cykooz.heif.image import RawHeifImage

with open('data/test.heif') as fp
    img = RawHeifImage.from_stream(fp)
    assert img.width == 3024
    assert img.height == 4032

此外,该软件包还为 PIL (Pillow) 提供了一个打开插件

from PIL import Image
from cykooz.heif.pil import register_heif_opener

register_heif_opener()
img = Image.open('data/test.heif')
assert isinstance(img, Image.Image)
assert img.size == (3024, 4032)
assert img.mode == 'RGB'
assert img.getpixel((100, 100)) == (73, 74, 69)
img.save('test.jpg', 'JPEG')

从源安装

系统需求

Ubuntu 22.04

$ sudo add-apt-repository ppa:strukturag/libheif
$ sudo add-apt-repository ppa:strukturag/libde265
$ sudo apt-get install build-essential python3-dev libheif-dev curl clang
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ source $HOME/.cargo/env
$ pip3 install .

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

cykooz.heif-1.0.1.tar.gz (14.3 kB 查看哈希值)

上传时间

构建分布

cykooz.heif-1.0.1-cp312-cp312-manylinux_2_28_x86_64.whl (4.7 MB 查看哈希值)

上传时间 CPython 3.12 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.1-cp311-cp311-manylinux_2_28_x86_64.whl (4.7 MB 查看哈希值)

上传时间 CPython 3.11 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.1-cp310-cp310-manylinux_2_28_x86_64.whl (4.7 MB 查看哈希值)

上传时间 CPython 3.10 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.1-cp39-cp39-manylinux_2_28_x86_64.whl (4.7 MB 查看哈希值)

上传时间 CPython 3.9 manylinux: glibc 2.28+ x86-64

cykooz.heif-1.0.1-cp38-cp38-manylinux_2_28_x86_64.whl (4.7 MB 查看哈希值)

上传时间 CPython 3.8 manylinux: glibc 2.28+ x86-64

支持者