Fix bird avatar generation.

This commit is contained in:
John Livingston 2024-02-09 17:28:16 +01:00
parent 8a3e046386
commit 5a00ec2406
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
1 changed files with 4 additions and 3 deletions

View File

@ -126,19 +126,20 @@ const path = require('node:path')
continue
}
const bodyFile = computeFilename('body', i)
const firstPart = Object.keys(parts)[0]
const firstFile = computeFilename(firstPart, i)
// We just have to combinate different parts into one file, then output at the wanted size.
const composites = []
let j = 0
for (const part of Object.keys(parts).filter(p => p !== 'body')) {
for (const part of Object.keys(parts).filter(p => p !== firstPart)) {
j++ // introduce an offset so we don't get all empty parts at the same time
composites.push({
input: computeFilename(part, i + (j * 7))
})
}
const buff = await sharp(bodyFile)
const buff = await sharp(firstFile)
.composite(composites)
.toBuffer()