Add a way to make transparent PNGs opaque.
This commit is contained in:
		
							parent
							
								
									69d0246301
								
							
						
					
					
						commit
						3efcff153f
					
				| 
						 | 
				
			
			@ -56,6 +56,7 @@ const project: Project = {
 | 
			
		|||
      midpoint: 0.6,
 | 
			
		||||
    }),
 | 
			
		||||
  ],
 | 
			
		||||
  resetAlpha: false,
 | 
			
		||||
  resolution: {
 | 
			
		||||
    width,
 | 
			
		||||
    height,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,7 @@ const project: Project = {
 | 
			
		|||
    }),
 | 
			
		||||
    new Generic('gegl:median-blur'),
 | 
			
		||||
  ],
 | 
			
		||||
  resetAlpha: false,
 | 
			
		||||
  resolution: {
 | 
			
		||||
    width,
 | 
			
		||||
    height,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@ const project: Project = {
 | 
			
		|||
      shape: 'circle',
 | 
			
		||||
    }),
 | 
			
		||||
  ],
 | 
			
		||||
  resetAlpha: false,
 | 
			
		||||
  resolution: {
 | 
			
		||||
    width,
 | 
			
		||||
    height,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,13 @@ async function main(): Promise<void> {
 | 
			
		|||
 | 
			
		||||
  const projects: Project[] = [d2022_03_06, d2022_03_07, d2022_03_08];
 | 
			
		||||
 | 
			
		||||
  for (const {createInputImage, name, operations, resolution} of projects) {
 | 
			
		||||
  for (const {
 | 
			
		||||
    createInputImage,
 | 
			
		||||
    name,
 | 
			
		||||
    operations,
 | 
			
		||||
    resolution,
 | 
			
		||||
    resetAlpha,
 | 
			
		||||
  } of projects) {
 | 
			
		||||
    const dataStart = performance.now();
 | 
			
		||||
    const {width, height} = resolution;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,6 +80,15 @@ async function main(): Promise<void> {
 | 
			
		|||
        ...graph,
 | 
			
		||||
      ]);
 | 
			
		||||
 | 
			
		||||
      if (resetAlpha) {
 | 
			
		||||
        await execa('convert', [
 | 
			
		||||
          fullOutputFile,
 | 
			
		||||
          '-alpha',
 | 
			
		||||
          'Off',
 | 
			
		||||
          fullOutputFile,
 | 
			
		||||
        ]);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      console.log(`* Writing ${compressedFile}`);
 | 
			
		||||
      await execa('magick', [
 | 
			
		||||
        'convert',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@ export default interface Project {
 | 
			
		|||
  createInputImage: boolean;
 | 
			
		||||
  name: string;
 | 
			
		||||
  operations: Array<InstanceType<typeof BaseOperation>>;
 | 
			
		||||
  resetAlpha: boolean;
 | 
			
		||||
  resolution: {
 | 
			
		||||
    height: number;
 | 
			
		||||
    width: number;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in New Issue