From 3e91edb4579ee4a4b476f0d201fc4afc5d66f1aa Mon Sep 17 00:00:00 2001 From: Michael Babienco Date: Tue, 3 Mar 2026 09:39:09 +0900 Subject: [PATCH] Downsize MB is now user-configurable Probably doesn't matter most of the time since we resize down HEIC and PNG anyway... Closes #7 --- src/Models/Settings.cs | 10 ++++++++++ src/ViewModels/MainViewModel.cs | 2 +- src/ViewModels/SettingsViewModel.cs | 10 ++++++++++ src/Views/SettingsView.axaml | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/Models/Settings.cs b/src/Models/Settings.cs index 77786f7..5d40ff0 100644 --- a/src/Models/Settings.cs +++ b/src/Models/Settings.cs @@ -15,6 +15,7 @@ class Settings : ChangeNotifier private bool _useDocnetPDFImageRendering; private bool _saveOutputPdfInWorkingDir; private string _outputPdfDir; + private decimal _imageResizeThreshold; public Settings() { @@ -22,6 +23,7 @@ class Settings : ChangeNotifier _useDocnetPDFImageRendering = true; _saveOutputPdfInWorkingDir = true; _outputPdfDir = ""; + _imageResizeThreshold = 1.5m; } public Settings(Settings other) @@ -30,6 +32,7 @@ class Settings : ChangeNotifier _useDocnetPDFImageRendering = other.UseDocnetPDFImageRendering; _saveOutputPdfInWorkingDir = other.SaveOutputPdfInWorkingDir; _outputPdfDir = other.OutputPdfDir; + _imageResizeThreshold = other.ImageResizeThreshold; } [JsonInclude] @@ -61,6 +64,13 @@ class Settings : ChangeNotifier set { _outputPdfDir = value; NotifyPropertyChanged(); } } + [JsonInclude] + public decimal ImageResizeThreshold + { + get => _imageResizeThreshold; + set { _imageResizeThreshold = value; NotifyPropertyChanged(); } + } + public static string GetSettingsFileName() { return "settings.json"; diff --git a/src/ViewModels/MainViewModel.cs b/src/ViewModels/MainViewModel.cs index 9ef78d4..11b9a87 100644 --- a/src/ViewModels/MainViewModel.cs +++ b/src/ViewModels/MainViewModel.cs @@ -706,7 +706,7 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown didAdjust = true; } // perform needed image manipulations - if (isHEIC || isWebp || isPNG || (!isPDF && info.Length > 1.5 * 1024 * 1024 /* 1.5 MB */)) + if (isHEIC || isWebp || isPNG || (!isPDF && info.Length > _settings.ImageResizeThreshold * 1024 * 1024)) { // Save image as jpg mImage.Quality = 80; diff --git a/src/ViewModels/SettingsViewModel.cs b/src/ViewModels/SettingsViewModel.cs index 0af2265..52cc762 100644 --- a/src/ViewModels/SettingsViewModel.cs +++ b/src/ViewModels/SettingsViewModel.cs @@ -87,6 +87,16 @@ class SettingsViewModel: ChangeNotifier } } + public decimal ImageResizeThreshold + { + get => _settings.ImageResizeThreshold; + set + { + _settings.ImageResizeThreshold = value; + NotifyPropertyChanged(nameof(ImageResizeThreshold)); + } + } + public async void ChooseOutputFolder() { var topLevel = _topLevelGrabber?.GetTopLevel(); diff --git a/src/Views/SettingsView.axaml b/src/Views/SettingsView.axaml index 3cac9bc..d163d9f 100644 --- a/src/Views/SettingsView.axaml +++ b/src/Views/SettingsView.axaml @@ -9,7 +9,7 @@ xmlns:models="clr-namespace:MayShow.Models" xmlns:vm="clr-namespace:MayShow.ViewModels" x:DataType="vm:SettingsViewModel" - MaxWidth="350"> + MaxWidth="450"> + + Always reduce size of images if above this file size in megabytes (MB): + + Use legacy PDF handling (does not work with macOS annotations) Always save report PDF in working directory