Use gravity instead of top/left for tile composite

This commit is contained in:
Maciej Ziarkowski 2019-10-07 17:01:41 +01:00
parent 14b79ce891
commit ed999e1311

View File

@ -26,26 +26,10 @@ async function stitchTile({ tileset, z, x, y, scale }: TileParams, dataParams: a
background: { r: 0, g: 0, b: 0, alpha: 0 } background: { r: 0, g: 0, b: 0, alpha: 0 }
} }
}).composite([ }).composite([
{ {input: topLeft, gravity: sharp.gravity.northwest},
input: topLeft, {input: topRight, gravity: sharp.gravity.northeast},
top: 0, {input: bottomLeft, gravity: sharp.gravity.southwest},
left: 0 {input: bottomRight, gravity: sharp.gravity.southeast}
},
{
input: topRight,
top: 0,
left: tileSize
},
{
input: bottomLeft,
top: tileSize,
left: 0
},
{
input: bottomRight,
top: tileSize,
left: tileSize
}
]).png().toBuffer(); ]).png().toBuffer();
return sharp(compositedBuffer) return sharp(compositedBuffer)