feat: actually handle image resolution setting

i added it to svg but forgot to add it for the rest of the images, nice
This commit is contained in:
Maya 2026-03-20 11:06:49 +03:00
parent 8b965c4e77
commit 4db3c69249
2 changed files with 23 additions and 0 deletions

View File

@ -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) => {

View File

@ -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;