heif

package
v0.0.0-...-be17ed1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxInputBytes = 32 * 1024 * 1024
)

Variables

View Source
var (
	ErrInputTooLarge = errors.New("HEIF image exceeds the input size limit")
	ErrImageTooLarge = errors.New("HEIF image exceeds the dimension limit")
	ErrInvalidMode   = errors.New("invalid HEIF conversion mode")
)

Functions

func ClearMemoryCache

func ClearMemoryCache(boxID string)

func Convert

func Convert(ctx context.Context, source []byte, mode Mode) ([]byte, error)

Convert 将 HEIF 转换为 JPEG,复用预览的尺寸、内存和并发限制,不写入缓存。

func ImageSize

func ImageSize(source []byte) (width, height int, err error)

func IsPath

func IsPath(path string) bool

func ReadFileLimited

func ReadFileLimited(path string, maxBytes int64) ([]byte, error)

Types

type Mode

type Mode string
const (
	ModePreview   Mode = "preview"
	ModeThumbnail Mode = "thumb"
)

type Options

type Options struct {
	Mode      Mode
	BoxID     string
	Encrypted bool
}

type Result

type Result struct {
	Data []byte
	Path string
	ETag string
}

func GetOrCreate

func GetOrCreate(ctx context.Context, source []byte, options Options) (Result, error)

Directories

Path Synopsis
internal
h265heic
Package heic decodes HEIF images that carry HEVC-coded item data, the format commonly called HEIC.
Package heic decodes HEIF images that carry HEVC-coded item data, the format commonly called HEIC.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址