Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michaelwp/go-watermark
This is a Go package to add a watermark onto an image
https://github.com/michaelwp/go-watermark
go image watermark
Last synced: 6 days ago
JSON representation
This is a Go package to add a watermark onto an image
- Host: GitHub
- URL: https://github.com/michaelwp/go-watermark
- Owner: michaelwp
- License: mit
- Created: 2024-07-05T09:02:57.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-15T15:02:31.000Z (7 months ago)
- Last Synced: 2024-07-16T11:11:41.215Z (7 months ago)
- Topics: go, image, watermark
- Language: Go
- Homepage: https://www.goblog.dev/articles/33
- Size: 1.72 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-watermark
This package allows you to add customizable watermarks to images using the Go programming language.
It provides functionalities for positioning, repeating text, and adjusting font properties.### Installation
```sh
go get github.com/michaelwp/go-watermark
```### Example
```go
package mainimport (
"fmt"
goWatermark "github.com/michaelwp/go-watermark"
"image/color"
)func main() {
watermark := &Watermark{
Image: "input.png",
OutputFile: "output.png",
Text: "Sample Watermark",
Position: Position{
PosX: 100,
PosY: 100,
PosAX: 0.5,
PosAY: 0.5,
},
Font: Font{
FontName: "path/to/font.ttf",
FontSize: 36,
},
Color: color.RGBA{255, 0, 0, 255},
Align: AlignCenter,
LineSpacing: 1.5,
Repeat: Repeat{
RepX: 1,
RepY: 1,
WordSpacing: 2,
},
}if err := AddWatermark(watermark); err != nil {
fmt.Println("Error adding watermark:", err)
} else {
fmt.Println("Watermark added successfully!")
}
}
```This example demonstrates how to configure and apply a watermark to an image using the `go_watermark` package. Adjust the parameters as needed to fit your specific use case.
for detail explanation visit: [How to Add a Watermark onto an Image Using Go](https://www.goblog.dev/articles/33)