Documentation ¶
Index ¶
- func CompressSingleImage(imageBytes []byte) ([]byte, error)
- func GetImageDimensions(url string) (int, int, error)
- func ProcessImages(imageData []io.Reader, compressor *Compressor) ([][]byte, error)
- func UploadBase64ImageToServer(base64Image string) (string, error)
- func UploadBase64RecordToServer(base64Image string) (string, error)
- type Compressor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressSingleImage ¶
CompressSingleImage 接收一个图片的 []byte 数据,并根据设定阈值返回压缩后的数据或原始数据。
func ProcessImages ¶
func ProcessImages(imageData []io.Reader, compressor *Compressor) ([][]byte, error)
func UploadBase64ImageToServer ¶
将base64图片通过lotus转换成url
func UploadBase64RecordToServer ¶
将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.
Click to show internal directories.
Click to hide internal directories.