Add a way to make transparent PNGs opaque.

This commit is contained in:
Bauke 2022-03-09 14:31:51 +01:00
parent 69d0246301
commit 3efcff153f
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
5 changed files with 20 additions and 1 deletions

View File

@ -56,6 +56,7 @@ const project: Project = {
midpoint: 0.6,
}),
],
resetAlpha: false,
resolution: {
width,
height,

View File

@ -51,6 +51,7 @@ const project: Project = {
}),
new Generic('gegl:median-blur'),
],
resetAlpha: false,
resolution: {
width,
height,

View File

@ -33,6 +33,7 @@ const project: Project = {
shape: 'circle',
}),
],
resetAlpha: false,
resolution: {
width,
height,

View File

@ -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',

View File

@ -4,6 +4,7 @@ export default interface Project {
createInputImage: boolean;
name: string;
operations: Array<InstanceType<typeof BaseOperation>>;
resetAlpha: boolean;
resolution: {
height: number;
width: number;