lite工程图片编译优化

Signed-off-by: fanjiaojiao <fanjiaojiao@huawei.com>
This commit is contained in:
fanjiaojiao
2022-08-31 18:04:59 +08:00
parent 0a92b14ee5
commit 26fe9cb57d
+4 -7
View File
@@ -64,15 +64,12 @@ async function img2bin(imgPath) {
binView.setUint8(binFileOffset, alpha, true);
binFileOffset += 1;
});
if (process.env.PLATFORM_VERSION_version <=6) {
const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin');
fs.writeFileSync(binPath1, Buffer.from(binBuffer));
const binPath1 = imgPath.replace(/(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/, '.bin');
fs.writeFileSync(binPath1, Buffer.from(binBuffer));
}
const binPath2 = imgPath+".bin";
fs.writeFileSync(binPath2, Buffer.from(binBuffer));
const binPath2 = imgPath+".bin";
fs.writeFileSync(binPath2, Buffer.from(binBuffer));
} catch (err) {
const imageName = _path.basename(imgPath);
console.error('\u001b[31m', `Failed to convert image ${imageName}.`, '\u001b[39m');