Documentation ¶
Index ¶
- func BytesToThumb(img []byte, thumbPath string) error
- func CheckFFmpeg() (ok bool)
- func FrameNail(in, out string, n int) error
- func Nail(img []byte, size, quality int) (*bytes.Buffer, error)
- func NailBytesToBase64(img []byte, thumbPath string) error
- func NailWrite(imgPath, thumbPath string) error
- func NailWrite64(imgPath, thumbPath string) error
- func OneFrame(in, out string, n int) error
- func OpenImage(imgPath string) (image.Image, error)
- func ReadImage(img []byte) (image.Image, error)
- func ResizeLimit(img []byte, limit float64, quality int) (*bytes.Buffer, error)
- func ResizeToFile(dst string, src []byte, limit float64, quality int) error
- func SmartCrop64(imgPath, dstPath string) error
- func SmartCropBytes64(imgBytes []byte, dstPath string) error
- type SubImager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToThumb ¶
BytesToThumb creates a thumbnail from img, uses default size and default quality, and write the thumbnail to thumbPath.
func Nail ¶
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 NailBytesToBase64 ¶
NailWrite64 convert the image to base64 and add prefix "data:image/jpeg;base64,"
func NailWrite ¶
NailWrite reads an image from imgPath, creates a thumbnail of it, and write the thumbnail to thumbPath.
func NailWrite64 ¶
NailWrite64 convert the image to base64 and add prefix "data:image/jpeg;base64,"
func OneFrame ¶
OneFrame 截取视频文件 in 的其中一帧 (第 n 秒),保存到文件 out 中。 建议 out 文件名的后缀为 ".jpg"。 例: OneFrame(video.mp4, screenshot.jpg, 10)
func ResizeLimit ¶
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.
func ResizeToFile ¶
ResizeToFile 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.
func SmartCrop64 ¶
SmartCrop64 convert the image to base64 and add prefix "data:image/jpeg;base64,"