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
Preset editor: rotation shows for PDF and is dropped where it can't apply
KnifeLemon8c9cda1e4ec2
diff --git a/src/Filee.App/ViewModels/PresetEditorViewModel.cs b/src/Filee.App/ViewModels/PresetEditorViewModel.csindex 2fdbbe44..45382072 100644--- a/src/Filee.App/ViewModels/PresetEditorViewModel.cs+++ b/src/Filee.App/ViewModels/PresetEditorViewModel.cs@@ -155,7 +155,7 @@ public sealed partial class PresetEditorViewModel : ObservableObjectprivate string _name;[ObservableProperty]- [NotifyPropertyChangedFor(nameof(ShowImage), nameof(ShowQuality), nameof(ShowTiff), nameof(ShowMultiPageTiff), nameof(ShowWebp), nameof(ShowIco),+ [NotifyPropertyChangedFor(nameof(ShowImage), nameof(ShowTurnForPdf), nameof(ShowQuality), nameof(ShowTiff), nameof(ShowMultiPageTiff), nameof(ShowWebp), nameof(ShowIco),nameof(ShowPdf), nameof(ShowPdfBuild), nameof(ShowDocument), nameof(ShowPdfSplit), nameof(ShowPdfCombine),nameof(ShowMedia), nameof(ShowMediaQuality), nameof(ShowMaxHeight), nameof(ShowAudioBitrate), nameof(ShowRemoveAudio),nameof(ShowAudioChannels), nameof(ShowWav), nameof(VideoCodecs), nameof(VideoCodecChoice), nameof(ShowVideoCodec),@@ -299,6 +299,10 @@ public sealed partial class PresetEditorViewModel : ObservableObject|| (TargetIsAudio && !LosslessAudioTargets.Contains(TargetId) && MediaCodecs.Effective(TargetId, _audioCodecValue) != AudioCodec.Alac);public bool ShowImage => TargetIsImage;+ /// <summary>Images and PDFs (pictures placed on pages) can be turned and flipped.</summary>+ private bool CanTurn => TargetIsImage || TargetId == "pdf";+ /// <summary>Rotate and flip for a PDF target, which has no image card to show them in.</summary>+ public bool ShowTurnForPdf => TargetId == "pdf";public bool ShowQuality => TargetId == BuiltInData.SameAsSource || LossyTargets.Contains(TargetId);public bool ShowTiff => TargetId is "tiff" or BuiltInData.SameAsSource;public bool ShowWebp => TargetId is "webp" or BuiltInData.SameAsSource;@@ -361,8 +365,10 @@ public sealed partial class PresetEditorViewModel : ObservableObjectvar image = _original.Image;image.Quality = Math.Clamp(Quality, 1, 100);image.Resize = Resize.Value;- image.Rotation = Rotation.Value;- image.Flip = Flip.Value;+ // 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;+ image.Flip = CanTurn ? Flip.Value : ImageFlip.None;image.ResizePercent = Math.Clamp(ResizePercent, 1, 1000);image.LongEdge = Math.Clamp(LongEdge, 16, 20000);image.Width = Math.Clamp(Width, 16, 20000);diff --git a/src/Filee.App/Views/PresetEditorView.axaml b/src/Filee.App/Views/PresetEditorView.axamlindex 44e28bfa..01686024 100644--- a/src/Filee.App/Views/PresetEditorView.axaml+++ b/src/Filee.App/Views/PresetEditorView.axaml@@ -235,6 +235,17 @@<NumericUpDown Value="{Binding MarginMm}" Minimum="0" Maximum="100" Increment="1" FormatString="0" /></StackPanel></Grid>+ <!-- Pictures placed on the pages are turned too; a PDF target has no image card to show this in -->+ <Grid ColumnDefinitions="*,12,*" IsVisible="{Binding ShowTurnForPdf}">+ <StackPanel>+ <TextBlock Classes="label" Text="{DynamicResource presets.rotation}" />+ <ComboBox ItemsSource="{Binding Rotations}" SelectedItem="{Binding Rotation}" HorizontalAlignment="Stretch" />+ </StackPanel>+ <StackPanel Grid.Column="2">+ <TextBlock Classes="label" Text="{DynamicResource presets.flip}" />+ <ComboBox ItemsSource="{Binding Flips}" SelectedItem="{Binding Flip}" HorizontalAlignment="Stretch" />+ </StackPanel>+ </Grid><Grid ColumnDefinitions="*,12,*"><StackPanel><TextBlock Classes="label" Text="{DynamicResource presets.render_dpi}" />diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.csindex 953d633e..aabfe58b 100644--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@ -635,6 +635,32 @@ public class RenderTestsAssert.Equal("jpg", preset.TargetFormat);}+ [AvaloniaFact]+ public void Preset_editor_keeps_rotation_visible_for_pdf_and_drops_it_for_targets_that_cannot_turn()+ {+ TestServices.EnsureInitialized("en");+ var loc = AppHost.Get<Filee.Core.Localization.ILocalizer>();++ // Photos → PDF are turned on the pages: the PDF card shows the rotation, and it is kept.+ var toPdf = Filee.Core.Presets.BuiltInData.CreatePresets().Single(p => p.Id == "rotate-left");+ var vm = new PresetEditorViewModel(toPdf, loc);+ vm.Target = vm.Targets.Single(t => t.Value == "pdf");+ Assert.False(vm.ShowImage);+ Assert.True(vm.ShowTurnForPdf);+ Assert.True(vm.Apply());+ Assert.Equal(Filee.Core.Presets.ImageRotation.Left90, toPdf.Image.Rotation);++ // A video can't be turned: a rotation left from the image target would fail every file with nothing on screen.+ var toVideo = Filee.Core.Presets.BuiltInData.CreatePresets().Single(p => p.Id == "rotate-left");+ vm = new PresetEditorViewModel(toVideo, loc);+ vm.Flip = vm.Flips.Single(f => f.Value == Filee.Core.Presets.ImageFlip.Vertical);+ vm.Target = vm.Targets.Single(t => t.Value == "mp4");+ Assert.False(vm.ShowTurnForPdf);+ Assert.True(vm.Apply());+ Assert.Equal(Filee.Core.Presets.ImageRotation.None, toVideo.Image.Rotation);+ Assert.Equal(Filee.Core.Presets.ImageFlip.None, toVideo.Image.Flip);+ }+[AvaloniaFact]public void Preset_editor_shows_and_saves_background_removal(){