我需要在上传的图像上应用水印。根据燃烧图像的文档,这是通过以下代码完成的:
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,因为我不想裁剪图像。
发布于 2015-04-09 11:21:27
只要从参数中删除位置坐标,它就会在默认情况下对水印进行中心化。
burningImageService.doWith('path/to/my/file', 'path/to/output/dir')
.execute {
it.watermark('path/to/watermark')
}欲了解更多信息,请参阅:handling
https://stackoverflow.com/questions/29536997
复制相似问题