Skip to content

armgit / Filee

Public Imported from GitHub
0

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.

Merge remote-tracking branch 'origin/main' into HEAD

KnifeLemon4343d671bdda
diff --cc src/Filee.App/ViewModels/PresetEditorViewModel.cs
index 74ad3c2f,9e74a1fa..61cda32b
--- a/src/Filee.App/ViewModels/PresetEditorViewModel.cs
+++ b/src/Filee.App/ViewModels/PresetEditorViewModel.cs
@@@ -664,19 -671,9 +679,21 @@@ public sealed partial class PresetEdito
_original.TargetFormat = TargetId;
var image = _original.Image;
image.Quality = Math.Clamp(Quality, 1, 100);
+ // Only where the field is shown, as with SaveEveryFrame below: a limit left behind by a JPG target fits nothing.
+ image.MaxSizeMb = ShowQuality ? SizeLimit(ImageMaxSizeMb) : 0;
- image.Resize = Resize.Value;
+ if (Resize.Value == ResizeMode.Custom)
+ {
+ // Custom sizing is stored as CustomSize with Resize None, never as a resize name an older version rejects
+ // (it would read presets.json as broken and fall back to the built-in presets, and the next save would
+ // write those over the user's own; issue #576).
+ image.Resize = ResizeMode.None;
+ image.CustomSize = new CustomImageSize { Width = Math.Clamp(CustomWidth, 16, 16384), Height = Math.Clamp(CustomHeight, 16, 16384), LockAspect = LockAspect };
+ }
+ else
+ {
+ image.Resize = Resize.Value;
+ image.CustomSize = null;
+ }
// Only images and PDFs are turned; for any other target a rotation left over from an earlier target would make
// every file fail ("can only turn images") with nothing on screen to turn it off.
image.Rotation = CanTurn ? Rotation.Value : ImageRotation.None;
diff --cc src/Filee.Core/Presets/Preset.cs
index 2b6388ea,ea4d79a6..52dc7535
--- a/src/Filee.Core/Presets/Preset.cs
+++ b/src/Filee.Core/Presets/Preset.cs
@@@ -330,13 -311,12 +330,19 @@@ public sealed class ImageOption
/// <summary>Lossy quality 1-100 (JPG, WEBP, AVIF, HEIC).</summary>
public int Quality { get; set; } = 90;
+ /// <summary>
+ /// Keep each picture under this many MB of 1,000,000 bytes; 0 = no limit. A larger one is saved again at a lower
+ /// quality, then smaller (down to a long edge of 640 px), until it fits (#553).
+ /// </summary>
+ public double MaxSizeMb { get; set; }
+
+ /// <summary>
+ /// How the picture is scaled. A preset with <see cref="CustomSize"/> set stores None here (custom sizing wins),
+ /// so a version without custom sizing simply does not resize instead of rejecting a name it does not know. The
+ /// lenient converter also reads a name a future version might add as None, and the writer maps Custom down to
+ /// None (see <see cref="ResizeModeJsonConverter"/>).
+ /// </summary>
+ [JsonConverter(typeof(ResizeModeJsonConverter))]
public ResizeMode Resize { get; set; } = ResizeMode.None;
/// <summary>Turns the image (after its EXIF orientation is applied).</summary>