Bird avatars.

This commit is contained in:
John Livingston
2024-02-09 15:12:48 +01:00
parent 41ce8e4233
commit fbeffef34b
158 changed files with 273 additions and 2 deletions

View File

@ -74,6 +74,15 @@ const path = require('node:path')
eyes: 15,
mouth: 10,
accessorie: 20 // 17 to 20 are empty
},
'bird': {
tail: 9, // here we must begin with the tail
hoop: 10,
body: 9,
wing: 9,
eyes: 9,
bec: 9,
accessorie: 16 // 15 to 20 are empty
}
}
@ -181,6 +190,32 @@ const path = require('node:path')
})
.toFile(path.join(botOutputDir, '1.png'))
}
{
// Moderation bot avatar: choosing some parts, and turning it so he is facing left.
const inputDir = path.join('./assets/images/avatars/', 'bird')
const botOutputDir = './dist/server/bot_avatars/bird/'
fs.mkdirSync(botOutputDir, { recursive: true })
const buff = await sharp(path.join(inputDir, 'tail_06.png'))
.composite([
{ input: path.join(inputDir, 'hoop_04.png')},
{ input: path.join(inputDir, 'body_07.png')},
{ input: path.join(inputDir, 'wing_03.png')},
{ input: path.join(inputDir, 'eyes_05.png')},
{ input: path.join(inputDir, 'bec_07.png')},
{ input: path.join(inputDir, 'accessorie_03.png')}
])
.toBuffer()
await sharp(buff)
.flop() // horizontal mirror
.resize(60, 60)
.png({
compressionLevel: 9,
palette: true
})
.toFile(path.join(botOutputDir, '1.png'))
}
}
generate().then(