images

package
v0.0.0-...-91ab160 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressSingleImage

func CompressSingleImage(imageBytes []byte) ([]byte, error)

CompressSingleImage 接收一个图片的 []byte 数据,并根据设定阈值返回压缩后的数据或原始数据。

func GetImageDimensions

func GetImageDimensions(url string) (int, int, error)

宽度 高度

func ProcessImages

func ProcessImages(imageData []io.Reader, compressor *Compressor) ([][]byte, error)

func ProcessInput

func ProcessInput(input string, clt *core.Client, filetype string) (string, error)

ProcessInput 处理输入字符串,上传文件并返回MediaId

func UploadBase64ImageToServer

func UploadBase64ImageToServer(base64Image string) (string, error)

将base64图片通过lotus转换成url

func UploadBase64RecordToServer

func UploadBase64RecordToServer(base64Image string) (string, error)

将base64语音通过lotus转换成url

Types

type Compressor

type Compressor struct {
	QualityStep int // Quality adjustment step
	MinQuality  int // Minimum quality
	MaxQuality  int // Maximum quality
	ThresholdKB int // Size threshold in KB
}

func NewCompressor

func NewCompressor(thresholdKB, qualityStep, minQuality, maxQuality int) *Compressor

func (*Compressor) CompressImage

func (c *Compressor) CompressImage(imageData io.Reader) ([]byte, error)

CompressImage handles image compression based on format.

Jump to

Keyboard shortcuts

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