Fix Image-Processing:

Format is not supported by Imagesharp, throwing exception causing Job to fail.
This commit is contained in:
2025-06-28 20:00:01 +02:00
parent 7e34b3b91e
commit 861cf7e166

View File

@ -134,21 +134,36 @@ public class DownloadSingleChapterJob : Job
{
if (!TrangaSettings.bwImages && TrangaSettings.compression == 100)
{
Log.Debug($"No processing requested for image");
Log.Debug("No processing requested for image");
return;
}
Log.Debug($"Processing image: {imagePath}");
try
{
using Image image = Image.Load(imagePath);
File.Delete(imagePath);
if (TrangaSettings.bwImages)
image.Mutate(i => i.ApplyProcessor(new AdaptiveThresholdProcessor()));
File.Delete(imagePath);
image.SaveAsJpeg(imagePath, new JpegEncoder()
{
Quality = TrangaSettings.compression
});
}
catch (Exception e)
{
Log.Error(e);
if (e is UnknownImageFormatException or NotSupportedException)
{
//If the Image-Format is not processable by ImageSharp, we can't modify it.
Log.Debug($"Unable to process {imagePath}: Not supported image format");
}else if (e is InvalidImageContentException)
{
Log.Debug($"Unable to process {imagePath}: Invalid Content");
}
}
}
private void CopyCoverFromCacheToDownloadLocation(Manga manga)
{