Created
September 4, 2022 12:04
-
-
Save 6londe/c3656a45ac15889a6fdaf54086470555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const rootPath = require('app-root-path'); | |
const composite = async () => { | |
const total = compositeInfo.length; | |
let current = 0; | |
for (const { background, hair, earrings, mouth, eyes, clothes } of compositeInfo) { | |
if (!fs.existsSync(`${rootPath}/images/${current}.png`)) { | |
const result = await compositeImage( | |
current, | |
[ | |
`${rootPath}/background/${background}`, | |
`${rootPath}/face/default_face.png`, | |
`${rootPath}/hair/${hair}`, | |
`${rootPath}/earrings/${earrings}`, | |
`${rootPath}/mouth/${mouth}`, | |
`${rootPath}/eyes/${eyes}`, | |
`${rootPath}/clothes/${clothes}`, | |
], | |
); | |
console.log(`[${current + 1}/${total}] ${result}`); | |
} | |
current += 1; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment