Documentation ¶
Index ¶
- Variables
- func DecodeFromBase64(base64 []byte) ([]byte, error)
- func DecodeToImageFile(base64 []byte, dest string, perm os.FileMode) error
- func DecodeWithBytes(imgData []byte) (img image.Image, format string, err error)
- func DecodeWithImagePath(imgPath string) (img image.Image, format string, err error)
- func EncodeToBase64String(data []byte) (string, error)
- func GetImageBase64(imagePath string) (string, error)
- func GetSize(path string) (width int, height int, err error)
- func GetWebImageBase64(url string) (string, error)
- func ToBmp(src, dest string) error
- func ToJpeg(src, dest string, qualityArgs ...int8) error
- func ToPng(src, dest string) error
- func ToTiff(src, dest string, opts *tiff.Options) error
- type Info
Constants ¶
This section is empty.
Variables ¶
Decode 解码图片(部分特殊格式不支持; path => image.Image).
@param r 类型可以是: *os.File(用完记得调用Close()) @return 第1个: image.Image实例
第2个: 表示图像的格式名称,例如 "png"、"jpeg" 等(不带"." && 转为小写) 第3个: error(可能为nil)
Functions ¶
func DecodeFromBase64 ¶
DecodeFromBase64 图片的base64数据 => 图片的数据(可以直接存储到硬盘上)
@param base64 带不带前缀都无所谓(e.g. "data:image/png;base64,"、"data:image/jpeg;base64,"、"data:image/gif;base64,")
func DecodeWithBytes ¶ added in v3.0.106
DecodeWithBytes []byte => image.Image
func EncodeToBase64String ¶
func GetImageBase64 ¶
GetImageBase64 (硬盘上的)图片 => base64字符串
参考: golang 将图片生成Base64 https://blog.csdn.net/weixin_40292098/article/details/126029489
func GetWebImageBase64 ¶
GetWebImageBase64 网络图片 => base64字符串
参考: golang 将图片生成Base64 https://blog.csdn.net/weixin_40292098/article/details/126029489
@param url e.g."https://img.redocn.com/sheying/20150507/pugongying_4267498.jpg"
Types ¶
Click to show internal directories.
Click to hide internal directories.