https://github.com/michaelwp/gowatermark
This is a Go package to add a watermark onto an image
https://github.com/michaelwp/gowatermark
go image watermark
Last synced: 2 months ago
JSON representation
This is a Go package to add a watermark onto an image
- Host: GitHub
- URL: https://github.com/michaelwp/gowatermark
- Owner: michaelwp
- License: mit
- Created: 2024-07-05T09:02:57.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-03-28T10:14:51.000Z (3 months ago)
- Last Synced: 2025-03-28T11:25:27.489Z (3 months ago)
- Topics: go, image, watermark
- Language: Go
- Homepage: https://www.goblog.dev/articles/33
- Size: 1.72 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goWatermark
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/goWatermark
```### Example
```go
package mainimport (
"fmt"
"image/color""github.com/michaelwp/goWatermark"
)func main() {
err := gowatermark.AddWatermark(
&gowatermark.Watermark{
Image: "input1.jpeg",
OutputFile: "output.jpeg",
Text: "79995782-PTGLOBALPRADANASEJAHTERA-227",
Position: gowatermark.Position{
PosAY: 10,
},
Font: gowatermark.Font{
FontSize: 12,
},
Color: color.RGBA{
R: 255,
G: 255,
B: 255,
A: 80,
},
Align: gowatermark.AlignCenter,
Repeat: gowatermark.Repeat{
RepY: 20,
RepX: 10,
},
LineSpacing: 25,
Rotate: -30,
ImgSize: gowatermark.ImgSize{
Width: 250,
},
},
)
if err != nil {
fmt.Println("Error:", 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)