Add a way to generate a blank input image.
This commit is contained in:
		
							parent
							
								
									8efa0898bf
								
							
						
					
					
						commit
						69d0246301
					
				| 
						 | 
				
			
			@ -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}),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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({
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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', {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ async function main(): Promise<void> {
 | 
			
		|||
 | 
			
		||||
  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<void> {
 | 
			
		|||
    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<void> {
 | 
			
		|||
      console.log(`* Writing ${compressedFile}`);
 | 
			
		||||
      await execa('magick', [
 | 
			
		||||
        'convert',
 | 
			
		||||
        path.join(baseDir, outputFile),
 | 
			
		||||
        fullOutputFile,
 | 
			
		||||
        '-quality',
 | 
			
		||||
        '92',
 | 
			
		||||
        path.join(baseDir, compressedFile),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
import {BaseOperation} from './gegl/exports.js';
 | 
			
		||||
 | 
			
		||||
export default interface Project {
 | 
			
		||||
  createInputImage: boolean;
 | 
			
		||||
  name: string;
 | 
			
		||||
  operations: Array<InstanceType<typeof BaseOperation>>;
 | 
			
		||||
  resolution: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in New Issue