thumb

package
v0.0.0-...-a5018ba Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToThumb

func BytesToThumb(img []byte, thumbPath string) error

BytesToThumb creates a thumbnail from img, uses default size and default quality, and write the thumbnail to thumbPath.

func CheckFFmpeg

func CheckFFmpeg() (ok bool)

CheckFFmpeg 检查系统有没有安装 ffmpeg 和 ffprobe

func FrameNail

func FrameNail(in, out string, n int) error

FrameNail 截取视频文件 in 中的一帧 (第 n 秒), 并剪裁成正方形缩略图保存到文件 out 中。

func Nail

func Nail(img []byte, size, quality int) (*bytes.Buffer, error)

Nail creates a thumbnail of the img. Use default size(128) if size is set to zero. Use default quality(85) if quality is set to zero.

func NailWrite

func NailWrite(imgPath, thumbPath string) error

NailWrite reads an image from imgPath, creates a thumbnail of it, and write the thumbnail to thumbPath.

func OneFrame

func OneFrame(in, out string, n int) error

OneFrame 截取视频文件 in 的其中一帧 (第 n 秒),保存到文件 out 中。 建议 out 文件名的后缀为 ".jpg"。 例: OneFrame(video.mp4, screenshot.jpg, 10)

func ReadImage

func ReadImage(img []byte) (image.Image, error)

ReadImage converts bytes to image. Supports webp.

func ResizeLimit

func ResizeLimit(img []byte, limit float64, quality int) (*bytes.Buffer, error)

ResizeLimit resizes the image if it's long side bigger than limit. Use default limit 900 if limit is set to zero. Use default quality 85 if quality is set to zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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