blob: 1d591bfa52fdfe84c5ba56d36db1e22c34093936 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
const fs = require('fs');
const exec = require('child_process').execSync;
const path = require('path');
let files = fs.readdirSync(".").filter(i => i.endsWith(".svg"));
for (let file of files) {
let name = file.substring(0, file.length - path.extname(file).length);
if (fs.existsSync("./uncolored/" + name + ".svg")) {
console.log(name + "*");
exec("convert -density 1200 -resize 448x448 -border 56x56 -bordercolor \"rgba(0,0,0,0)\" -channel RGB -depth 32 -negate -background none ./uncolored/" + file + " ./favicon/" + name + "-pre.png");
exec("convert -composite -compose Dst_Over -gravity center -depth 32 -geometry 512x512 ./favicon/" + name + "-pre.png ../logo/newlogo-template.png -set colorspace RGB ./favicon/" + name + ".png");
} else {
console.log(name);
exec("convert -density 1200 -resize 448x448 -border 56x56 -bordercolor \"rgba(0,0,0,0)\" -channel RGB -depth 32 -negate -background none " + file + " ./favicon/" + name + "-pre.png");
exec("convert -composite -compose Dst_Over -gravity center -depth 32 -geometry 512x512 ./favicon/" + name + "-pre.png ../logo/newlogo-template.png -set colorspace RGB ./favicon/" + name + ".png");
}
fs.unlinkSync("./favicon/" + name + "-pre.png");
}
|