Skip to content

armgit / VERT

Public Imported from GitHub
0

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

feat: actually handle image resolution setting

Maya4db3c6924926
diff --git a/src/lib/converters/mediabunny.svelte.ts b/src/lib/converters/mediabunny.svelte.ts
index b65752d..569cbfe 100644
--- a/src/lib/converters/mediabunny.svelte.ts
+++ b/src/lib/converters/mediabunny.svelte.ts
@@ -533,6 +533,13 @@ export class MediabunnyConverter extends Converter {
stay: 10000,
},
});
+
+ if (!isValid) {
+ this.activeConversions.delete(file.id);
+ throw new Error(
+ `Mediabunny cannot produce an output for ${file.name} due to unsupported tracks/codecs.`,
+ );
+ }
}
conversion.onProgress = (progress) => {
diff --git a/src/lib/workers/magick.ts b/src/lib/workers/magick.ts
index 92b4e49..b6e694f 100644
--- a/src/lib/workers/magick.ts
+++ b/src/lib/workers/magick.ts
@@ -293,6 +293,22 @@ const magickConvert = async (
let fmt = to.slice(1).toUpperCase();
if (fmt === "JFIF") fmt = "JPEG";
+ const resolution = conversionSettings.resolution as string;
+ if (resolution && resolution !== "auto") {
+ const actualResolution =
+ resolution === "custom"
+ ? (conversionSettings.customResolution as string)
+ : resolution;
+
+ const [width, height] = actualResolution
+ .split("x")
+ .map((dim: string) => parseInt(dim));
+
+ if (width && height) {
+ img.resize(width, height);
+ }
+ }
+
// ICO size clamp to avoid WidthOrHeightExceedsLimit
if (fmt === "ICO") {
const max = 256;