Add a way to generate a blank input image.

This commit is contained in:
Bauke 2022-03-09 00:40:01 +01:00
parent 8efa0898bf
commit 69d0246301
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
5 changed files with 18 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import Project from './project.js';
const [width, height] = [1920, 1080]; const [width, height] = [1920, 1080];
const project: Project = { const project: Project = {
createInputImage: false,
name: '2022-03-06', name: '2022-03-06',
operations: [ operations: [
new SimplexNoise({scale: 4, seed: 2_071_140_406}), new SimplexNoise({scale: 4, seed: 2_071_140_406}),

View File

@ -4,6 +4,7 @@ import Project from './project.js';
const [width, height] = [1920, 1080]; const [width, height] = [1920, 1080];
const project: Project = { const project: Project = {
createInputImage: false,
name: '2022-03-07', name: '2022-03-07',
operations: [ operations: [
new Plasma({ new Plasma({

View File

@ -10,6 +10,7 @@ import Project from './project.js';
const [width, height] = [1920, 1080]; const [width, height] = [1920, 1080];
const project: Project = { const project: Project = {
createInputImage: false,
name: '2022-03-08', name: '2022-03-08',
operations: [ operations: [
new Generic('gegl:diffraction-patterns', { new Generic('gegl:diffraction-patterns', {

View File

@ -18,7 +18,7 @@ async function main(): Promise<void> {
const projects: Project[] = [d2022_03_06, d2022_03_07, d2022_03_08]; 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 dataStart = performance.now();
const {width, height} = resolution; const {width, height} = resolution;
@ -55,10 +55,21 @@ async function main(): Promise<void> {
if (noRender) { if (noRender) {
console.log(`* Skipped ${outputFile}`); console.log(`* Skipped ${outputFile}`);
} else { } else {
const fullOutputFile = path.join(baseDir, outputFile);
if (createInputImage) {
await execa('magick', [
'-size',
`${width}x${height}`,
'xc:white',
fullOutputFile,
]);
}
console.log(`* Writing ${outputFile}`); console.log(`* Writing ${outputFile}`);
await execa('gegl', [ await execa('gegl', [
...(createInputImage ? ['-i', fullOutputFile] : []),
'-o', '-o',
path.join(baseDir, outputFile), fullOutputFile,
'--', '--',
...graph, ...graph,
]); ]);
@ -66,7 +77,7 @@ async function main(): Promise<void> {
console.log(`* Writing ${compressedFile}`); console.log(`* Writing ${compressedFile}`);
await execa('magick', [ await execa('magick', [
'convert', 'convert',
path.join(baseDir, outputFile), fullOutputFile,
'-quality', '-quality',
'92', '92',
path.join(baseDir, compressedFile), path.join(baseDir, compressedFile),

View File

@ -1,6 +1,7 @@
import {BaseOperation} from './gegl/exports.js'; import {BaseOperation} from './gegl/exports.js';
export default interface Project { export default interface Project {
createInputImage: boolean;
name: string; name: string;
operations: Array<InstanceType<typeof BaseOperation>>; operations: Array<InstanceType<typeof BaseOperation>>;
resolution: { resolution: {