From 8911cdab8d178a78c067005ddc7ba675df2aa9d9 Mon Sep 17 00:00:00 2001 From: Maya Date: Wed, 30 Jul 2025 10:42:23 +0300 Subject: [PATCH] feat: raw camera formats, swf --- src/lib/converters/ffmpeg.svelte.ts | 2 +- src/lib/converters/magick-automated.ts | 1 + src/lib/converters/magick.svelte.ts | 27 +++++++++++++++++++++++--- src/lib/converters/vertd.svelte.ts | 1 + src/lib/workers/magick.ts | 10 +++------- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/lib/converters/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg.svelte.ts index 065eb49..07e3796 100644 --- a/src/lib/converters/ffmpeg.svelte.ts +++ b/src/lib/converters/ffmpeg.svelte.ts @@ -56,7 +56,7 @@ export class FFmpegConverter extends Converter { new FormatInfo("mp1", true, false), new FormatInfo("mp2", true, true), new FormatInfo("mpc", true, false), // unknown if it works, can't find sample file but ffmpeg should support i think? - new FormatInfo("raw", true, false), // usually pcm + //new FormatInfo("raw", true, false), // usually pcm new FormatInfo("dsd", true, false), // dsd new FormatInfo("dsf", true, false), // dsd new FormatInfo("dff", true, false), // dsd diff --git a/src/lib/converters/magick-automated.ts b/src/lib/converters/magick-automated.ts index fcbb84d..17df80c 100644 --- a/src/lib/converters/magick-automated.ts +++ b/src/lib/converters/magick-automated.ts @@ -41,6 +41,7 @@ export const imageFormats = [ new FormatInfo("farbfeld", true, true), new FormatInfo("fax", true, true), // not ideal (image became super long for some reason) new FormatInfo("ff", true, true), + new FormatInfo("fit", true, true), // not ideal (grayscale) new FormatInfo("fits", true, true), // not ideal (grayscale) new FormatInfo("fl32", true, true), new FormatInfo("fts", true, true), // not ideal (grayscale) diff --git a/src/lib/converters/magick.svelte.ts b/src/lib/converters/magick.svelte.ts index c48815f..1648415 100644 --- a/src/lib/converters/magick.svelte.ts +++ b/src/lib/converters/magick.svelte.ts @@ -19,6 +19,7 @@ export class MagickConverter extends Converter { public ready = $state(false); public supportedFormats = [ + // manually tested formats new FormatInfo("png", true, true), new FormatInfo("jpeg", true, true), new FormatInfo("jpg", true, true), @@ -40,20 +41,40 @@ export class MagickConverter extends Converter { new FormatInfo("cr2", true, false), new FormatInfo("hdr", true, true), new FormatInfo("jpe", true, true), - new FormatInfo("dng", true, false), new FormatInfo("mat", true, true), new FormatInfo("pbm", true, true), new FormatInfo("pfm", true, true), new FormatInfo("pgm", true, true), new FormatInfo("pnm", true, true), new FormatInfo("ppm", true, true), - new FormatInfo("tif", true, true), new FormatInfo("tiff", true, true), new FormatInfo("jfif", true, true), new FormatInfo("eps", false, true), - new FormatInfo("arw", true, false), new FormatInfo("psd", true, true), + // raw camera formats + new FormatInfo("arw", true, false), + new FormatInfo("tif", true, true), + new FormatInfo("dng", true, false), + new FormatInfo("xcf", true, false), + new FormatInfo("rw2", true, false), + new FormatInfo("raf", true, false), + new FormatInfo("orf", true, false), + new FormatInfo("pef", true, false), + new FormatInfo("mos", true, false), + new FormatInfo("raw", true, false), + new FormatInfo("dcr", true, false), + new FormatInfo("crw", true, false), + new FormatInfo("cr3", true, false), + new FormatInfo("3fr", true, false), + new FormatInfo("erf", true, false), + new FormatInfo("mrw", true, false), + new FormatInfo("mef", true, false), + new FormatInfo("nrw", true, false), + new FormatInfo("srw", true, false), + new FormatInfo("sr2", true, false), + new FormatInfo("srf", true, false), + // formats added from maya's somewhat automated testing ...imageFormats, ]; diff --git a/src/lib/converters/vertd.svelte.ts b/src/lib/converters/vertd.svelte.ts index 8216809..1ea3fe2 100644 --- a/src/lib/converters/vertd.svelte.ts +++ b/src/lib/converters/vertd.svelte.ts @@ -226,6 +226,7 @@ export class VertdConverter extends Converter { new FormatInfo("rmvb", true, false), new FormatInfo("h264", true, true), new FormatInfo("divx", true, true), + new FormatInfo("swf", true, true), ]; // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/lib/workers/magick.ts b/src/lib/workers/magick.ts index 1db298a..b287e9b 100644 --- a/src/lib/workers/magick.ts +++ b/src/lib/workers/magick.ts @@ -28,13 +28,9 @@ const handleMessage = async (message: any): Promise => { case "convert": { if (!message.to.startsWith(".")) message.to = `.${message.to}`; message.to = message.to.toLowerCase(); - if (message.to === ".jfif") { - message.to = ".jpeg"; - } - - if (message.input.from === ".jfif") { - message.input.from = ".jpeg"; - } + if (message.to === ".jfif") message.to = ".jpeg"; + if (message.input.from === ".jfif") message.input.from = ".jpeg"; + if (message.input.from === ".fit") message.input.from = ".fits"; const buffer = await message.input.file.arrayBuffer(); // only wait when we need to