Resolve composite watermark issue (#908)
This commit is contained in:
parent
ca86d3e1a6
commit
13eeeaffad
1 changed files with 7 additions and 2 deletions
|
@ -780,8 +780,9 @@ export const serve_rendered = {
|
||||||
image.resize(width * scale, height * scale);
|
image.resize(width * scale, height * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var composite_array = [];
|
||||||
if (opt_overlay) {
|
if (opt_overlay) {
|
||||||
image.composite([{ input: opt_overlay }]);
|
composite_array.push({ input: opt_overlay });
|
||||||
}
|
}
|
||||||
if (item.watermark) {
|
if (item.watermark) {
|
||||||
const canvas = createCanvas(scale * width, scale * height);
|
const canvas = createCanvas(scale * width, scale * height);
|
||||||
|
@ -794,7 +795,11 @@ export const serve_rendered = {
|
||||||
ctx.fillStyle = 'rgba(0,0,0,.4)';
|
ctx.fillStyle = 'rgba(0,0,0,.4)';
|
||||||
ctx.fillText(item.watermark, 5, height - 5);
|
ctx.fillText(item.watermark, 5, height - 5);
|
||||||
|
|
||||||
image.composite([{ input: canvas.toBuffer() }]);
|
composite_array.push({ input: canvas.toBuffer() });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (composite_array.length > 0) {
|
||||||
|
image.composite(composite_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatQuality = (options.formatQuality || {})[format];
|
const formatQuality = (options.formatQuality || {})[format];
|
||||||
|
|
Loading…
Reference in a new issue