save with max height 1280 in order to save on traffic during upload

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-05-27 00:32:02 +03:00
parent e317ce2310
commit d4adb64655
+6 -1
View File
@@ -4,6 +4,7 @@ using System.Windows.Input;
using Azaion.Annotator.DTO;
using LibVLCSharp.Shared;
using MediatR;
using MS.WindowsAPICodePack.Internal;
namespace Azaion.Annotator;
@@ -15,6 +16,7 @@ public class PlayerControlHandler(LibVLC libVLC, MediaPlayer mediaPlayer, MainWi
{
private const int STEP = 20;
private const int LARGE_STEP = 5000;
private const int RESULT_WIDTH = 1280;
private static readonly string[] CatchSenders = ["ForegroundWindow", "ScrollViewer", "VideoView"];
@@ -193,7 +195,10 @@ public class PlayerControlHandler(LibVLC libVLC, MediaPlayer mediaPlayer, MainWi
Directory.CreateDirectory(config.ImagesDirectory);
await File.WriteAllTextAsync($"{config.LabelsDirectory}/{fName}.txt", labels);
mediaPlayer.TakeSnapshot(0, $"{config.ImagesDirectory}/{fName}.jpg", 0, 0);
var resultHeight = (uint)Math.Round(RESULT_WIDTH / formState.CurrentVideoSize.Width * formState.CurrentVideoSize.Height);
mediaPlayer.TakeSnapshot(0, $"{config.ImagesDirectory}/{fName}.jpg", RESULT_WIDTH, resultHeight);
mainWindow.Annotations[fName] = currentAnns;
mainWindow.Editor.RemoveAllAnns();