Skip to content

Commit

Permalink
Improve image parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwilarg committed Jul 20, 2024
1 parent bb4053a commit 0c95cc9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions downloader/Downloader/Downloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
<PackageReference Include="MessageBox.Avalonia" Version="3.1.5.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions downloader/Downloader/Models/ProcessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Net.Http;
using System.Threading;
using Downloader.ViewModels;
using Avalonia.Media.Imaging;
using SixLabors.ImageSharp;

namespace Downloader.Models
{
Expand Down Expand Up @@ -110,8 +110,8 @@ public static async IAsyncEnumerable<float> DownloadImageAsync(HttpClient client
yield return prog;
}
ms.Position = 0;
var bmp = new Bitmap(ms);
bmp.Save(savePath);
var image = Image.Load(ms);
image.Save(savePath);
}
}
}
4 changes: 4 additions & 0 deletions downloader/Downloader/ViewModels/ImportAlbumsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public ImportAlbumsViewModel(MainViewModel mainViewModel)
s.Album = path;
_mainViewModel.SaveImage(path, album, url);
}
else
{
s.Album = path;
}
}
}
Expand Down

0 comments on commit 0c95cc9

Please sign in to comment.