From 3f6b351d2304ab11c431f42ddc57c79d4e464914 Mon Sep 17 00:00:00 2001 From: Bauke Date: Tue, 8 Mar 2022 23:00:01 +0100 Subject: [PATCH] Also output a compressed JPEG. --- source/driftingnebula.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/driftingnebula.ts b/source/driftingnebula.ts index 3fc73bd..4837eb9 100644 --- a/source/driftingnebula.ts +++ b/source/driftingnebula.ts @@ -44,6 +44,7 @@ async function main(): Promise { const graphFile = `${name}.txt`; const outputFile = `${name}.png`; + const compressedFile = `${outputFile.slice(0, -4)}.jpeg`; console.log(`* Writing ${graphFile}`); await fsp.writeFile( @@ -61,6 +62,15 @@ async function main(): Promise { '--', ...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);