在 Grails 中使用刻录图像插件时如何居中对齐水印

How to center align watermark when using burning image plugin in Grails

我需要为上传的图片添加水印。根据刻录图像的文档,这是通过以下代码完成的:

def orginalFileName      
burningImageService.doWith('path/to/my/file.jpg', 'path/to/output/dir')
    .execute {
        it.scaleApproximate(800, 600)
        orginalFileName = it.watermark('path/to/watermark',
                                       ['right':10, 'bottom': 10])
    }
    .execute ('thumbnail', {
        it.scaleAccurate(200, 200)
    })

有没有不需要计算坐标的简单居中对齐水印的方法?我不能使用给定的大小 (800,600),因为它是一个近似大小。我不能使用 scaleAccurate,因为我不想裁剪图像。

去掉参数中的位置坐标,水印默认居中

burningImageService.doWith('path/to/my/file', 'path/to/output/dir')
                   .execute {
                       it.watermark('path/to/watermark')
                    }

更多信息请参考: https://code.google.com/p/burningimage/wiki/Images_manipulation_handling