Performance Improvements and Some Polish (#1702)
* Auto scale reading timeline * Added benchmarks for SharpImage and NetVips. When an epub has a malformed page, catch the error and present it better to the user. * Added a hint for an upcoming feature * Slightly sped up word count for epubs * Added one more test to reflect actual code. * Some light cleanup * Use compact number for stat lists * Fixed brightness being broken on manga reader * Replaced CoverToWebP SharpImage version with NetVips which is MUCH lighter on memory and CPU. * Added last modified on the progress dto for CdDisplayEx. * Code cleanup * Forgot one cleanup
This commit is contained in:
parent
d1596c4ab7
commit
b62d340bb3
15 changed files with 192 additions and 123 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NetVips;
|
||||
using SixLabors.ImageSharp;
|
||||
using Image = NetVips.Image;
|
||||
|
||||
|
|
@ -113,15 +114,15 @@ public class ImageService : IImageService
|
|||
return filename;
|
||||
}
|
||||
|
||||
public async Task<string> ConvertToWebP(string filePath, string outputPath)
|
||||
public Task<string> ConvertToWebP(string filePath, string outputPath)
|
||||
{
|
||||
var file = _directoryService.FileSystem.FileInfo.FromFileName(filePath);
|
||||
var fileName = file.Name.Replace(file.Extension, string.Empty);
|
||||
var outputFile = Path.Join(outputPath, fileName + ".webp");
|
||||
|
||||
using var sourceImage = await SixLabors.ImageSharp.Image.LoadAsync(filePath);
|
||||
await sourceImage.SaveAsWebpAsync(outputFile);
|
||||
return outputFile;
|
||||
using var sourceImage = Image.NewFromFile(filePath, false, Enums.Access.SequentialUnbuffered);
|
||||
sourceImage.WriteToFile(outputFile);
|
||||
return Task.FromResult(outputFile);
|
||||
}
|
||||
|
||||
public async Task<bool> IsImage(string filePath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue