Files
playlet-piped/tools/generate-images.js
T
Brahim Hadricheandgithub-action linter 9d8a3d1cea Create Component Library (#43)
* Move src under playlet-lib

* Update configuration

* Update script

* Update script

* Working version

* Vs code config WIP

* Package lock sync

* Lint fix

* Fix images

* Reuse config files

* Kind of a working setup

* Lock node version

* Rename scripts to tools

* Fix build scripts, lib url system

* Lint fix

* rale

* Fix args and web server

* Load fallbacks and build script cleanups

* Remove unused method

* no message

* no message

* Remove generic message field

* Lint fix

* no message

* Use loading indicator on main app

* Add playlet lib version to settings

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-01-29 16:50:28 -05:00

77 lines
1.9 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const { convertFile } = require('convert-svg-to-png');
const logoPoster = './playlet/src/images/vector/logo-light.svg';
const logoSplash = './playlet/src/images/vector/logo-dark.svg';
const logoOutput = {
// Logo
"splash-screen_fhd.jpg": {
width: 1920,
height: 1080,
background: "#242424",
from: logoSplash
},
"splash-screen_hd.jpg": {
width: 1280,
height: 720,
background: "#242424",
from: logoSplash
},
"splash-screen_sd.jpg": {
width: 720,
height: 480,
background: "#242424",
from: logoSplash
},
"channel-poster_fhd.png": {
width: 540,
height: 405,
background: "#FFFFFF",
from: logoPoster
},
"channel-poster_hd.png": {
width: 290,
height: 218,
background: "#FFFFFF",
from: logoPoster
},
"channel-poster_sd.png": {
width: 246,
height: 140,
background: "#FFFFFF",
from: logoPoster
},
};
const iconsInput = './playlet/src/images/vector/icons';
const iconsOutput = './playlet-lib/src/images/icons';
(async () => {
for (var logo in logoOutput) {
await convertFile(logoOutput[logo].from, {
outputFilePath: './playlet/src/images/' + logo,
background: logoOutput[logo].background,
height: logoOutput[logo].height,
width: logoOutput[logo].width,
});
console.log(`Generated ${logo}`);
}
const iconFiles = fs.readdirSync(iconsInput);
for (var i in iconFiles) {
const input = path.join(iconsInput, iconFiles[i]);
const output = path.join(iconsOutput, iconFiles[i].replace('.svg', '.png'));
await convertFile(input, {
outputFilePath: output,
width: 64,
height: 64,
});
console.log(`Generated ${output}`);
}
})();