Also output a compressed JPEG.

This commit is contained in:
Bauke 2022-03-08 23:00:01 +01:00
parent 693b44aeef
commit 3f6b351d23
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,7 @@ async function main(): Promise<void> {
const graphFile = `${name}.txt`; const graphFile = `${name}.txt`;
const outputFile = `${name}.png`; const outputFile = `${name}.png`;
const compressedFile = `${outputFile.slice(0, -4)}.jpeg`;
console.log(`* Writing ${graphFile}`); console.log(`* Writing ${graphFile}`);
await fsp.writeFile( await fsp.writeFile(
@ -61,6 +62,15 @@ async function main(): Promise<void> {
'--', '--',
...graph, ...graph,
]); ]);
console.log(`* Writing ${compressedFile}`);
await execa('magick', [
'convert',
path.join(baseDir, outputFile),
'-quality',
'92',
path.join(baseDir, compressedFile),
]);
} }
const time = (performance.now() - dataStart).toFixed(2); const time = (performance.now() - dataStart).toFixed(2);