image

package
v0.0.0-...-7994a47 Latest Latest
Warning

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

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

Documentation

Overview

Package image 提供 QQ 官方富媒体所需的基础图片格式适配。

只处理 QQ 官方明确支持的图片格式:png / jpg / gif。 非支持格式会尽量转成 png(bmp 转 jpg),不依赖外部 ffmpeg。

Index

Constants

View Source
const (
	// MaxImageBytes 单张图片最大输入大小,默认 50 MiB。
	MaxImageBytes = 50 << 20
	// MaxImageDimension 单边最大像素,防止解压炸弹。
	MaxImageDimension = 10000
)

Variables

This section is empty.

Functions

func CheckImage

func CheckImage(r io.ReadSeeker) (string, bool)

CheckImage 通过 content-type 判断数据是否像图片。

func EncodeImage

func EncodeImage(data []byte) ([]byte, error)

EncodeImage 把非 png/jpg/gif 的图片转成 QQ 官方支持的格式。 已经是 png/jpg/gif 的数据会原样返回。

func IsGIFOrPNGOrJPG

func IsGIFOrPNGOrJPG(data []byte) bool

IsGIFOrPNGOrJPG 判断数据是否已经是 QQ 官方支持的图片格式。

Types

This section is empty.

Jump to

Keyboard shortcuts

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