Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

fix: magick leftover args if empty / false

JovannMCa5521ecb732d
diff --git a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
index 4a42b9f..19b8b72 100644
--- a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
+++ b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
@@ -470,11 +470,10 @@ export class FFmpegConverter extends Converter {
}
// channels setting
- if (settings.channels !== 2) {
- channelsArgs = ["-ac", String(settings.channels)];
- this.log(
- `using user setting for audio channels: ${settings.channels}`,
- );
+ const channels = Number(settings.channels);
+ if (Number.isInteger(channels) && channels !== 2) {
+ channelsArgs = ["-ac", String(channels)];
+ this.log(`using user setting for audio channels: ${channels}`);
}
// video to audio
diff --git a/src/lib/workers/magick.ts b/src/lib/workers/magick.ts
index be50de9..1bce043 100644
--- a/src/lib/workers/magick.ts
+++ b/src/lib/workers/magick.ts
@@ -56,7 +56,7 @@ const handleMessage = async (
message.to = message.to.toLowerCase();
if (message.to === ".jfif") message.to = ".jpeg";
- let to = message.input.to;
+ let to = message.to;
let from = message.input.from;
if (from === ".jfif") from = ".jpeg";
if (from === ".fit") from = ".fits";
@@ -430,8 +430,8 @@ const magickConvert = async (
// magick-wasm automatically clamps (https://github.com/dlemstra/magick-wasm/blob/76fc6f2b0c0497d2ddc251bbf6174b4dc92ac3ea/src/magick-image.ts#L2480)
if (quality) img.quality = quality;
- if (bitDepth !== "auto") img.depth = bitDepth;
- if (!metadata) img.strip();
+ if (bitDepth && bitDepth !== "auto") img.depth = bitDepth;
+ if (metadata === false) img.strip();
if (colorSpace) {
switch (colorSpace) {
case "srgb":
@@ -461,7 +461,7 @@ const magickConvert = async (
// auto is default so do nothing
}
}
- if (!transparency) {
+ if (transparency === false) {
img.backgroundColor = new MagickColor(0, 0, 0, 255); // TODO: probably make it an option to set the bg colour
img.alpha(AlphaAction.Remove);
}
diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte
index 7e9da63..367547c 100644
--- a/src/routes/about/+page.svelte
+++ b/src/routes/about/+page.svelte
@@ -56,7 +56,7 @@
name: "Liam",
github: "https://x.com/z2rMC",
role: m["about.credits.roles.liam"](),
- avatar: avatarLiam
+ avatar: avatarLiam,
},
];