Documentation ¶
Index ¶
- func ColorHexToRGBA(hex string) (uint8, uint8, uint8, error)
- func ColorToNRGBA(originalColor color.Color) color.NRGBA
- func IsValidImageExt(ext string) bool
- func ParseContentToImage(content string) (image.Image, error)
- func ParseHexColor(hex string) (color.Color, error)
- type DrawTextItem
- type FlipTypeEnums
- type IHandle
- func (h *IHandle) Base64Prefix() string
- func (h *IHandle) Blur(sigma float64) (err error)
- func (h *IHandle) ContentBytes() ([]byte, error)
- func (h *IHandle) ContentString() string
- func (h *IHandle) Corp(rect image.Rectangle) (err error)
- func (h *IHandle) CropAnchor(width, height int) error
- func (h *IHandle) CropCenter(width, height int) error
- func (h *IHandle) Ext() string
- func (h *IHandle) Fill(width, height int, resFilters ...imaging.ResampleFilter) error
- func (h *IHandle) Fit(width, height int, resFilters ...imaging.ResampleFilter) error
- func (h *IHandle) Flip(flipType FlipTypeEnums) (err error)
- func (h *IHandle) GetFilePath() string
- func (h *IHandle) ImageColorToConvert(originImg image.Image, colorHex string) (image.Image, error)
- func (h *IHandle) ImgWH() (width, height int)
- func (h *IHandle) IsOpen() (err error)
- func (h *IHandle) Open() (image.Image, error)
- func (h *IHandle) Overlay(images ...IOverlayItem) (err error)
- func (h *IHandle) OverlayDrawText(item IOverlayItem, ift *ifont.IFont) (srcImg image.Image, err error)
- func (f *IHandle) ParseHexColor(colorHex string) (color.Color, error)
- func (h *IHandle) Resize(width, height int, resFilters ...imaging.ResampleFilter) error
- func (h *IHandle) Rotate(angle float64, bgColor color.Color) (err error)
- func (h *IHandle) Save() (err error)
- func (h *IHandle) SetDir(dir string)
- func (h *IHandle) SetFilename(filename string)
- func (h *IHandle) SetFilenameSuffix(filenameSuffix string)
- func (h *IHandle) SetFontPath(path string)
- func (h *IHandle) SetImg(img image.Image)
- func (h *IHandle) SetPath(path string)
- func (h *IHandle) SetSuffix(suffix string)
- func (h *IHandle) Sharpen(sigma float64) (err error)
- func (h *IHandle) Thumb(width, height int, resFilters ...imaging.ResampleFilter) error
- type IOverlayItem
- type ImageAttr
- type ImageExt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorHexToRGBA ¶
ColorHexToRGBA 将十六进制颜色转换为RGBA
func ColorToNRGBA ¶
ColorToNRGBA 根据指定颜色转换原始颜色
func ParseContentToImage ¶
ParseContentToImage 解析图片内容并转换为图片
Types ¶
type DrawTextItem ¶
type DrawTextItem struct { Text string `json:"text" dc:"文字"` ColorHex string `json:"color_hex" dc:"字体颜色(二进制)"` TextType uint `json:"text_type" dc:"文本类型:0空白(无需绘制), 1文本(无需分割),2分割文本(如:价格)"` FontSize float64 `json:"font_size" dc:"文本字体大小"` TextX int `json:"text_x" dc:"文本X坐标"` TextY int `json:"text_y" dc:"文本Y坐标"` Sep string `json:"sep" dc:"分割符:指定文案类型"` }
DrawTextItem 绘制文本属性
type FlipTypeEnums ¶
type FlipTypeEnums uint
FlipTypeEnums 翻转类型
const ( FlipTypeH FlipTypeEnums = iota // 水平翻转图像 FlipTypeV //垂直翻转图像 FlipTypeTranspose //水平翻转图像并逆时针旋转90度 FlipTypeTransverse // 垂直翻转图像并逆时针旋转90度 FlipTypeRotate90 // 旋转90度 )
type IHandle ¶
type IHandle struct {
// contains filtered or unexported fields
}
func (*IHandle) ContentBytes ¶
ContentBytes 读取内容转为[]byte
func (*IHandle) ContentString ¶
ContentString 把图片内容转换为base64字符
func (*IHandle) CropAnchor ¶
CropAnchor 指定定位点和要裁剪的宽高进行裁剪
func (*IHandle) CropCenter ¶
CropCenter 剪切出指定大小的矩形区域
func (*IHandle) Fill ¶
func (h *IHandle) Fill(width, height int, resFilters ...imaging.ResampleFilter) error
Fill 调整srcImage的大小并裁剪以填充100x100px的区域。
func (*IHandle) Fit ¶
func (h *IHandle) Fit(width, height int, resFilters ...imaging.ResampleFilter) error
Fit 缩小srcImage以适应800x600px的边界框。
func (*IHandle) ImageColorToConvert ¶
ImageColorToConvert 转换图片颜色
func (*IHandle) Overlay ¶
func (h *IHandle) Overlay(images ...IOverlayItem) (err error)
Overlay 图片合成
func (*IHandle) OverlayDrawText ¶
func (h *IHandle) OverlayDrawText(item IOverlayItem, ift *ifont.IFont) (srcImg image.Image, err error)
OverlayDrawText 图片合成绘制文本
func (*IHandle) ParseHexColor ¶
ParseHexColor 解析二进制颜色值
func (*IHandle) Resize ¶
func (h *IHandle) Resize(width, height int, resFilters ...imaging.ResampleFilter) error
Resize 使用Lanczos过滤器将srcImage的调整大小
func (*IHandle) SetFilenameSuffix ¶
SetFilenameSuffix 设置后置文件名,例如:thump_800x800
type IOverlayItem ¶
type IOverlayItem struct { Src string `json:"path" dc:"配图地址"` PointX int `json:"point_x" dc:"位置坐标X"` PointY int `json:"point_y" dc:"位置坐标Y"` Opacity float64 `json:"opacity" dc:"透明度0-1"` UnderColor string `json:"under_color" dc:"配图色系"` DrawText *DrawTextItem `json:"draw_texts" dc:"绘制字体文本属性"` }
IOverlayItem 图片合成属性
Click to show internal directories.
Click to hide internal directories.