From 69d02463016e8ce22d2042f467579bba91f12894 Mon Sep 17 00:00:00 2001 From: Bauke Date: Wed, 9 Mar 2022 00:40:01 +0100 Subject: [PATCH] Add a way to generate a blank input image. --- source/2022-03-06.ts | 1 + source/2022-03-07.ts | 1 + source/2022-03-08.ts | 1 + source/driftingnebula.ts | 17 ++++++++++++++--- source/project.ts | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/source/2022-03-06.ts b/source/2022-03-06.ts index b675f63..e0cfb48 100644 --- a/source/2022-03-06.ts +++ b/source/2022-03-06.ts @@ -11,6 +11,7 @@ import Project from './project.js'; const [width, height] = [1920, 1080]; const project: Project = { + createInputImage: false, name: '2022-03-06', operations: [ new SimplexNoise({scale: 4, seed: 2_071_140_406}), diff --git a/source/2022-03-07.ts b/source/2022-03-07.ts index cc988a5..5a9e68b 100644 --- a/source/2022-03-07.ts +++ b/source/2022-03-07.ts @@ -4,6 +4,7 @@ import Project from './project.js'; const [width, height] = [1920, 1080]; const project: Project = { + createInputImage: false, name: '2022-03-07', operations: [ new Plasma({ diff --git a/source/2022-03-08.ts b/source/2022-03-08.ts index 803ff47..a628973 100644 --- a/source/2022-03-08.ts +++ b/source/2022-03-08.ts @@ -10,6 +10,7 @@ import Project from './project.js'; const [width, height] = [1920, 1080]; const project: Project = { + createInputImage: false, name: '2022-03-08', operations: [ new Generic('gegl:diffraction-patterns', { diff --git a/source/driftingnebula.ts b/source/driftingnebula.ts index 4837eb9..cfa8949 100644 --- a/source/driftingnebula.ts +++ b/source/driftingnebula.ts @@ -18,7 +18,7 @@ async function main(): Promise { const projects: Project[] = [d2022_03_06, d2022_03_07, d2022_03_08]; - for (const {name, operations, resolution} of projects) { + for (const {createInputImage, name, operations, resolution} of projects) { const dataStart = performance.now(); const {width, height} = resolution; @@ -55,10 +55,21 @@ async function main(): Promise { if (noRender) { console.log(`* Skipped ${outputFile}`); } else { + const fullOutputFile = path.join(baseDir, outputFile); + if (createInputImage) { + await execa('magick', [ + '-size', + `${width}x${height}`, + 'xc:white', + fullOutputFile, + ]); + } + console.log(`* Writing ${outputFile}`); await execa('gegl', [ + ...(createInputImage ? ['-i', fullOutputFile] : []), '-o', - path.join(baseDir, outputFile), + fullOutputFile, '--', ...graph, ]); @@ -66,7 +77,7 @@ async function main(): Promise { console.log(`* Writing ${compressedFile}`); await execa('magick', [ 'convert', - path.join(baseDir, outputFile), + fullOutputFile, '-quality', '92', path.join(baseDir, compressedFile), diff --git a/source/project.ts b/source/project.ts index 2952f41..c21ad87 100644 --- a/source/project.ts +++ b/source/project.ts @@ -1,6 +1,7 @@ import {BaseOperation} from './gegl/exports.js'; export default interface Project { + createInputImage: boolean; name: string; operations: Array>; resolution: {