daShangDao_planA/modules/image/image.go

27 lines
1.0 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package image
import (
planBImage "planA/planB/modules/image"
)
// WatermarkConfig 添加水印
type WatermarkConfig struct {
SourceImageURL string // 源图片URL地址
WatermarkURL string // 水印图片URL地址
Opacity float64 // 不透明度 (0.0-1.0)
Position string // 位置: center, top-left, top-right, bottom-left, bottom-right, tile
TileSpacing int // 平铺时的间距
Scale float64 // 水印缩放比例 (0.0-1.0)
Rotation float64 // 旋转角度 (度数)
XOffset int // X轴偏移量
YOffset int // Y轴偏移量
Timeout int // 下载超时时间默认30秒
OutputFormat string // 输出格式: "jpeg", "png", "auto"默认auto根据源图片格式auto
JPEGQuality int // JPEG质量 (1-100)默认95
}
// AddWatermarkFromURLExs 添加水印
func AddWatermarkFromURLExs(sourceImageUrl, watermarkUrl string) (string, error) {
return planBImage.AddWatermarkFromURLExs(sourceImageUrl, watermarkUrl)
}