Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Merge origin/main into fix/issues-batch-3
KnifeLemon05232254bd16
diff --cc docs/ENGINES.mdindex d78e331b,e80f3c9e..294d5d9b--- a/docs/ENGINES.md+++ b/docs/ENGINES.md@@@ -7,12 -7,12 +7,12 @@@ Filee chooses engines automatically. Se|---|---|---|| ImageMagick (Magick.NET) | built in (library) | JPG, PNG, WEBP, TIFF, BMP, GIF, ICO, AVIF, JPEG XL, JPEG 2000, PSD/PSB, TGA, PPM, MNG, QOI, DDS, PCX, CUR, XPM, XBM, WBMP, PAM, PFM, SGI, Sun Raster, MIFF ↔ each other, and **APNG** (Filee's own reader and writer); HEIC (written with FFmpeg), XCF, camera RAW (LibRaw), DICOM (uncompressed ones by Filee's own reader), Photo CD, OpenEXR, Radiance HDR, EMF/WMF (Windows) and the photo of an iPhone LIVP read || Windows Imaging Component | part of Windows (Windows only) | **JPEG XR** (JXR, WDP, HDP; HDR screenshots of Windows) → the images ImageMagick writes, and PDF, ICNS, HEIC and SVG through PNG; HDR tone-mapped to SDR |- | Vector graphics | built in (Svg.Skia, SkiaSharp, ACadSharp) | **SVG/SVGZ → PDF (vector) and images**, SVG ↔ SVGZ, **SVG → DXF** (→ DWG with the CAD engine), **raster images → SVG (tracing)**, PDF-compatible AI → PDF, **Tajima DST embroidery → SVG** (stitches as lines, a palette colour per thread; → PNG, JPG, PDF from there) |-| Vector graphics | built in (Svg.Skia, SkiaSharp, ACadSharp) | **SVG/SVGZ → PDF (vector) and images**, SVG ↔ SVGZ, **SVG → DXF** (→ DWG with the CAD engine), **raster images → SVG (tracing)**, PDF-compatible AI → PDF, **HP-GL / HP-GL/2 plot files (PLT) → SVG**, PDF and images (pen moves, packed PE polylines, arcs and filled polygons; text labels are not drawn) |++| Vector graphics | built in (Svg.Skia, SkiaSharp, ACadSharp) | **SVG/SVGZ → PDF (vector) and images**, SVG ↔ SVGZ, **SVG → DXF** (→ DWG with the CAD engine), **raster images → SVG (tracing)**, PDF-compatible AI → PDF, **HP-GL / HP-GL/2 plot files (PLT) → SVG**, PDF and images (pen moves, packed PE polylines, arcs and filled polygons; text labels are not drawn), **Tajima DST embroidery → SVG** (stitches as lines, a palette colour per thread; → PNG, JPG, PDF from there) || ICNS | built in | images → ICNS (16–1024 px), ICNS → images |- | PDFsharp | built in (library) | images → PDF, merge, split, page ranges, **compression** (smaller PDFs, see below) |+ | PDFsharp | built in (library) | images → PDF, merge, split, page ranges, **compression** (smaller PDFs, see below), PDFs without their metadata || PDFium | built in (library) | PDF → images (multi-page TIFF/GIF supported) || Unhwp | built in (library) | HWP/HWPX → TXT, Markdown, HTML (pictures in a `<name>_files` folder next to the Markdown, embedded in the HTML) |- | Text & Markdown (Markdig) | built in (library) | **Markdown → HTML, TXT**; **TXT, LOG, PY, PAC, BAT, COMMAND → UTF-8 TXT**, preserving source text without running scripts (and → PDF / DOCX through the HWPX writer, rhwp or LibreOffice) |+ | Text & Markdown (Markdig) | built in (library) | **Markdown → HTML, TXT**; **TXT, LOG, PY, PAC, BAT, COMMAND, LUA, CSS → UTF-8 TXT**, preserving source text without running scripts (and → PDF / DOCX through the HWPX writer, rhwp or LibreOffice) || Spreadsheets (ExcelDataReader for XLS) | built in (library) | **XLSX, XLS, ODS, CSV, TSV → XLSX, ODS, CSV, TSV** (one CSV / TSV per sheet) || Office Open XML | built in | **DOCM / DOTX / DOTM ↔ DOCX, XLSM / XLTX ↔ XLSX, PPTM / POTX / POTM / PPSX ↔ PPTX** (macros removed for macro-free types) || Fonts | built in | **TTF, OTF, WOFF, WOFF2, EOT ↔ each other**; CFF (PostScript) outlines become TrueType for TTF and EOT |diff --cc src/Filee.Core/Formats/FormatRegistry.csindex 6456ba3c,2542fed9..ba30df55--- a/src/Filee.Core/Formats/FormatRegistry.cs+++ b/src/Filee.Core/Formats/FormatRegistry.cs@@@ -66,9 -66,8 +66,10 @@@ public static class FormatRegistrnew("wmf", "WMF", FormatCategory.Vector, ["wmf"]),new("cdr", "CDR", FormatCategory.Vector, ["cdr"], Writable: false),new("cgm", "CGM", FormatCategory.Vector, ["cgm"], Writable: false),+ new("plt", "PLT", FormatCategory.Vector, ["plt", "hpgl", "hpg", "hgl"], Writable: false),new("vsd", "VSD", FormatCategory.Vector, ["vsd", "vsdx"], Writable: false),+ // Tajima embroidery designs: the stitches drawn as lines (issue #397).+ new("dst", "DST", FormatCategory.Vector, ["dst"], Writable: false),new("odg", "ODG", FormatCategory.Vector, ["odg"]),new("fodg", "FODG", FormatCategory.Vector, ["fodg"], Writable: false),diff --cc src/Filee.Core/Settings/AppSettings.csindex 3df95d28,abbde438..1e4cbe88--- a/src/Filee.Core/Settings/AppSettings.cs+++ b/src/Filee.Core/Settings/AppSettings.cs@@@ -112,7 -112,7 +112,7 @@@ public sealed class DonutSettingpublic sealed class AppSettings{/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>- public const int CurrentSchemaVersion = 33;- public const int CurrentSchemaVersion = 37;++ public const int CurrentSchemaVersion = 38;public int SchemaVersion { get; set; } = CurrentSchemaVersion;diff --cc src/Filee.Core/Settings/UserDataStore.csindex 5a909eda,a6b22665..885ddb08--- a/src/Filee.Core/Settings/UserDataStore.cs+++ b/src/Filee.Core/Settings/UserDataStore.cs@@@ -750,9 -750,47 +750,50 @@@ internal static class SettingsMigration// v32: logs and script source, Video CD DAT and Workbench archives learn their donuts; custom claims stay put.if (from < 32)changed |= LearnExtensions(profiles, out _, ["log", "py", "pac", "bat", "command", "dat", "wbpz"]);- // v33: Tajima embroidery designs (.dst) learn the vector donut; custom claims stay put.+ // v33: HAR network logs and raw H.265 / H.264 camera streams learn their donuts (custom claims stay put), and+ // "Trim transparent borders" comes in after "Remove background".if (from < 33)+ {+ changed |= LearnExtensions(profiles, out _, ["har", "h265", "265", "hevc", "h264", "264"]);+ // "Trim transparent borders" after "Remove background", in the library and on the images donut's back face+ // when it has room and the user hasn't put it there.+ if (BuiltInData.TrimPresets().Single() is var trim && presets.All(p => p.Id != trim.Id))+ {+ var at = presets.FindIndex(p => p.Id == "remove-background");+ presets.Insert(at < 0 ? presets.Count : at + 1, trim);+ changed = true;+ }+ if (profiles.FirstOrDefault(p => p.Id == "images") is { BackPresetIds: { } back } images+ && !back.Contains("trim-transparent") && !images.PresetIds.Contains("trim-transparent")+ && back.Count < ToolbarProfile.MaxSlices)+ {+ var after = back.IndexOf("remove-background");+ back.Insert(after < 0 ? back.Count(id => id != "zip-all") : after + 1, "trim-transparent");+ changed = true;+ }+ }+ // v34: Lua scripts and CSS style sheets learn the text donut; custom claims stay put.+ if (from < 34)+ changed |= LearnExtensions(profiles, out _, ["lua", "css"]);+ // v35: HP-GL plot files learn their donut; custom claims stay put.+ if (from < 35)+ changed |= LearnExtensions(profiles, out _, ["plt", "hpgl", "hpg", "hgl"]);+ // v36: iCalendar (.ics, .ical) on the data donut, and "iCalendar" (CSV → ICS) after "vCard" on the back of the+ // spreadsheets donut when it has room; custom claims stay put.+ if (from < 36)+ {+ changed |= LearnExtensions(profiles, out _, ["ics", "ical"]);+ changed |= AddCalendarPreset(presets, profiles);+ }+ // v37: everyday tools (compress image / video / audio, video from images, extract audio, merge videos / audio,+ // remove metadata), after "Motion Photo (Android)" as in a new library, and on the back faces of the+ // built-in donuts before "One ZIP" where they have room and the user hasn't put them there already.+ // "Extract audio" replaces the plain M4A slice on the video donut's back.+ if (from < 37)+ changed |= AddMediaTools(presets, profiles);++ // v38: Tajima embroidery designs (.dst) learn the vector donut; custom claims stay put.++ if (from < 38)+ changed |= LearnExtensions(profiles, out _, ["dst"]);return changed;}diff --cc src/Filee.Engines/Media/MediaEncoding.csindex e669986b,f088ab3a..5a351130--- a/src/Filee.Engines/Media/MediaEncoding.cs+++ b/src/Filee.Engines/Media/MediaEncoding.cs@@@ -230,17 -230,14 +230,17 @@@ internal static class MediaEncodinIReadOnlySet<string>? encoders, HardwareEncoder? hardware){var video = info.Video ?? throw new InvalidOperationException("The file has no video stream.");- // An input without sound is fine: the output simply has no audio track.- var audio = options.RemoveAudio ? null : info.Audio;+ // An input without sound is fine: the output simply has no audio track. Every track is kept (languages,+ // commentary, issue #396), except in containers that hold one.+ IReadOnlyList<AudioStreamInfo> tracks = options.RemoveAudio ? []+ : SingleAudioTargets.Contains(target) ? [.. info.AudioTracks.Take(1)]+ : info.AudioTracks;List<string> args = [.. Common, "-i", input, "-map", "0:V:0"];- if (audio is not null)- args.AddRange(["-map", "0:a:0"]);+ for (var i = 0; i < tracks.Count; i++)+ args.AddRange(["-map", $"0:a:{i}"]);- if (CanCopyVideo(target, video, options))+ if (!info.RawStream && CanCopyVideo(target, video, options)){args.AddRange(["-c:v", "copy"]);// Apple plays HEVC in MP4/MOV only under the "hvc1" tag (FFmpeg keeps "hev1" from some sources).diff --cc src/Filee.Engines/Media/MediaInfo.csindex 8cd483b2,862469f3..af2d2895--- a/src/Filee.Engines/Media/MediaInfo.cs+++ b/src/Filee.Engines/Media/MediaInfo.cs@@@ -71,13 -75,14 +75,19 @@@ internal sealed record AudioStreamInfo(/// <param name="Audio">First audio stream, if any.</param>/// <param name="CoverStreamIndex">Index of an embedded cover picture (JPEG or PNG) such as album art, if any.</param>/// <param name="SubtitleStreams">Every subtitle stream in file order, null when there is none.</param>+ /// <param name="RawStream">+ /// A bare H.264 / H.265 stream with no container (a camera's .h264 / .h265): its frames carry no timestamps, so it is+ /// always encoded, never copied into a container.+ /// </param>+ /// <param name="HasAttachments">The file carries attachments (an MKV's subtitle fonts).</param>+/// <param name="AudioStreams">Every audio stream in file order (languages, commentary), null for none or only one.</param>internal sealed record MediaInfo(TimeSpan? Duration, VideoStreamInfo? Video, AudioStreamInfo? Audio, int? CoverStreamIndex,- IReadOnlyList<SubtitleStreamInfo>? SubtitleStreams = null, IReadOnlyList<AudioStreamInfo>? AudioStreams = null)- IReadOnlyList<SubtitleStreamInfo>? SubtitleStreams = null, bool RawStream = false, bool HasAttachments = false)++ IReadOnlyList<SubtitleStreamInfo>? SubtitleStreams = null, bool RawStream = false, bool HasAttachments = false,++ IReadOnlyList<AudioStreamInfo>? AudioStreams = null){+ /// <summary>Every audio stream, in file order: <see cref="Audio"/> first.</summary>+ public IReadOnlyList<AudioStreamInfo> AudioTracks => AudioStreams ?? (Audio is null ? [] : [Audio]);+/// <summary>Every subtitle stream, in file order.</summary>public IReadOnlyList<SubtitleStreamInfo> Subtitles => SubtitleStreams ?? [];@@@ -107,7 -112,7 +117,8 @@@AudioStreamInfo? audio = null;int? cover = null;List<SubtitleStreamInfo> subtitles = [];+ List<AudioStreamInfo> audios = [];+ var attachments = false;double longestStream = 0;if (root.TryGetProperty("streams", out var streams) && streams.ValueKind == JsonValueKind.Array){@@@ -130,13 -135,16 +141,17 @@@FrameRateOf(stream),Text(stream, "codec_name"),Text(stream, "pix_fmt"),- ColorOf(stream));+ ColorOf(stream),+ Text(stream, "extradata_hash"));break;- case "audio" when audio is null:- audio = new AudioStreamInfo((int)Number(stream, "channels"), (int)Number(stream, "sample_rate"),- Text(stream, "codec_name"));+ case "audio":+ audios.Add(new AudioStreamInfo((int)Number(stream, "channels"), (int)Number(stream, "sample_rate"),+ Text(stream, "codec_name")));+ audio ??= audios[0];break;+ case "attachment":+ attachments = true;+ break;case "subtitle":subtitles.Add(new SubtitleStreamInfo((int)Number(stream, "index"), Text(stream, "codec_name"),stream.TryGetProperty("tags", out var tags) ? Text(tags, "language") : null));@@@ -148,8 -156,9 +163,9 @@@var seconds = root.TryGetProperty("format", out var format) ? Number(format, "duration") : 0;if (seconds <= 0)seconds = longestStream;+ var raw = root.TryGetProperty("format", out var container) && Text(container, "format_name") is "h264" or "hevc";return new MediaInfo(seconds > 0 ? TimeSpan.FromSeconds(seconds) : null, video, audio, cover,- subtitles.Count > 0 ? subtitles : null, audios.Count > 1 ? audios : null);- subtitles.Count > 0 ? subtitles : null, raw, attachments);++ subtitles.Count > 0 ? subtitles : null, raw, attachments, audios.Count > 1 ? audios : null);}/// <summary>The colour tags of a video stream; null when it has none ("unknown" counts as none).</summary>diff --cc src/Filee.Engines/Vector/VectorConverter.csindex 9645e140,d7ab9dbe..ceda5164--- a/src/Filee.Engines/Vector/VectorConverter.cs+++ b/src/Filee.Engines/Vector/VectorConverter.cs@@@ -41,8 -41,8 +41,10 @@@ public sealed class VectorConverter : Inew("svgz", "dxf"),// Illustrator files are PDF inside (or PostScript, see ConvertIllustratorAsync).new("ai", "pdf"),+ // Embroidery designs: their stitches as lines (DstEmbroidery), PNG / PDF / ... from there.+ new("dst", "svg"),+ // HP-GL plot files: their pen moves as lines (HpglPlot), PDF / PNG / ... from there.+ new("plt", "svg"),// Raster images are traced (other raster formats through PNG, e.g. ICNS; never vector files or documents)... ImageEncoder.Readable.Select(source => new ConversionEdge(source, "svg", TraceCost, ImageSourcesOnly: true)),];@@@ -56,7 -56,7 +58,8 @@@("ai", "pdf") => await ConvertIllustratorAsync(step, progress, cancellationToken),("svg", "svgz") => await Task.Run(() => Compress(step), cancellationToken),("svgz", "svg") => await Task.Run(() => Decompress(step), cancellationToken),+ ("dst", "svg") => await Task.Run(() => Embroidery(step), cancellationToken),+ ("plt", "svg") => await Task.Run(() => Plot(step), cancellationToken),(_, "svg") => await Task.Run(() => RasterTracing.Run(step, progress, cancellationToken), cancellationToken),(_, "dxf") => await Task.Run(() => ToDxf(step, cancellationToken), cancellationToken),(_, "pdf") => await Task.Run(() => ToPdf(step, cancellationToken), cancellationToken),@@@ -66,16 -66,16 +69,26 @@@return written;}+ private static IReadOnlyList<string> Embroidery(ConversionStep step)+ {+ var svg = DstEmbroidery.ToSvg(File.ReadAllBytes(step.InputPath));+ var output = step.Output.Allocate("svg");+ if (output is null)+ return [];+ File.WriteAllText(output, svg, new UTF8Encoding(false));+ return [output];+ }++ private static IReadOnlyList<string> Plot(ConversionStep step)+ {+ var svg = HpglPlot.ToSvg(File.ReadAllBytes(step.InputPath));+ var output = step.Output.Allocate("svg");+ if (output is null)+ return [];- File.WriteAllText(output, svg, new System.Text.UTF8Encoding(false));++ File.WriteAllText(output, svg, new UTF8Encoding(false));+ return [output];+ }+private static IReadOnlyList<string> ToPdf(ConversionStep step, CancellationToken ct){using var drawing = SvgRenderer.Load(step.InputPath);diff --cc tests/Filee.Engines.Tests/TracingTests.csindex 1e5c3fac,82d265b1..cf0f151f--- a/tests/Filee.Engines.Tests/TracingTests.cs+++ b/tests/Filee.Engines.Tests/TracingTests.cs@@@ -465,8 -465,8 +465,10 @@@ public class TracingTests(EngineFixturAssert.True(checkedRoutes > 1000);}- // SVGZ is unpacked and an embroidery design's stitches are drawn as lines: neither is traced.- private static bool IsTracing(RouteStep step) => step.Converter is VectorConverter && step.To == "svg" && step.From is not ("svgz" or "dst");- // SVGZ is unpacked and a plot file's pen moves are drawn (HpglPlot): neither is tracing.- private static bool IsTracing(RouteStep step) => step.Converter is VectorConverter && step.To == "svg" && step.From is not ("svgz" or "plt");++ // SVGZ is unpacked, a plot file's pen moves (HpglPlot) and an embroidery design's stitches (DstEmbroidery) are++ // drawn as lines: none of them is tracing.++ private static bool IsTracing(RouteStep step) =>++ step.Converter is VectorConverter && step.To == "svg" && step.From is not ("svgz" or "plt" or "dst");/// <summary>The vector engine without its tracing edges.</summary>private sealed class WithoutTracing(IConverter inner) : IConverter