media

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package media 提供 OFD 包中图像资源的读取和解码能力。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(reader ContentReader, filename string) (image.Image, error)

Decode 从包内容读取器中读取并解码栅格图像。

func DecodeBytes added in v0.1.0

func DecodeBytes(data []byte) (image.Image, error)

DecodeBytes 从内存中的图像字节直接解码栅格图像。

func EncodePNG added in v0.1.4

func EncodePNG(w io.Writer, img image.Image) error

EncodePNG 使用默认压缩级别和池化的 PNG 编码缓冲区写出图像。

func EncodePNGLevel added in v0.1.4

func EncodePNGLevel(w io.Writer, img image.Image, level int) error

EncodePNGLevel 使用指定压缩级别和池化缓冲区写出图像。

func ExtractFirstImage

func ExtractFirstImage(filename string) (image.Image, error)

ExtractFirstImage 从基于 ZIP 的文件中提取第一张可以解码的图片。

func IsImageExtension

func IsImageExtension(ext string) bool

IsImageExtension 判断扩展名是否为支持的栅格图片格式。

Types

type ContentReader

type ContentReader interface {
	Read(string) ([]byte, error)
}

ContentReader 提供读取文件解压后内容的能力。

Jump to

Keyboard shortcuts

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