1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-11-29 23:07:40 +02:00

Optimize watermark application

This commit is contained in:
DarthSim
2023-05-10 17:46:02 +03:00
parent e8952edbf7
commit 85f790fb4b
5 changed files with 37 additions and 18 deletions

View File

@@ -771,10 +771,10 @@ func (img *Image) Embed(width, height int, offX, offY int) error {
return nil
}
func (img *Image) ApplyWatermark(wm *Image, opacity float64) error {
func (img *Image) ApplyWatermark(wm *Image, left, top int, opacity float64) error {
var tmp *C.VipsImage
if C.vips_apply_watermark(img.VipsImage, wm.VipsImage, &tmp, C.double(opacity)) != 0 {
if C.vips_apply_watermark(img.VipsImage, wm.VipsImage, &tmp, C.int(left), C.int(top), C.double(opacity)) != 0 {
return Error()
}
C.swap_and_clear(&img.VipsImage, tmp)