ProcessImage Logging

This commit is contained in:
2025-10-02 17:14:33 +02:00
parent db74af9217
commit 1e0abe637f

View File

@@ -183,6 +183,7 @@ public class DownloadChapterFromMangaconnectorWorker(MangaConnectorId<Chapter> c
private bool ProcessImage(Stream imageStream, out Stream processedImage) private bool ProcessImage(Stream imageStream, out Stream processedImage)
{ {
Log.Debug("Processing image");
if (!Tranga.Settings.BlackWhiteImages && Tranga.Settings.ImageCompression == 100) if (!Tranga.Settings.BlackWhiteImages && Tranga.Settings.ImageCompression == 100)
{ {
Log.Debug("No processing requested for image"); Log.Debug("No processing requested for image");
@@ -194,12 +195,14 @@ public class DownloadChapterFromMangaconnectorWorker(MangaConnectorId<Chapter> c
try try
{ {
using Image image = Image.Load(imageStream); using Image image = Image.Load(imageStream);
Log.Debug("Image loaded");
if (Tranga.Settings.BlackWhiteImages) if (Tranga.Settings.BlackWhiteImages)
image.Mutate(i => i.ApplyProcessor(new AdaptiveThresholdProcessor())); image.Mutate(i => i.ApplyProcessor(new AdaptiveThresholdProcessor()));
image.SaveAsJpeg(processedImage, new JpegEncoder() image.SaveAsJpeg(processedImage, new JpegEncoder()
{ {
Quality = Tranga.Settings.ImageCompression Quality = Tranga.Settings.ImageCompression
}); });
Log.Debug("Image processed");
return true; return true;
} }
catch (Exception e) catch (Exception e)
@@ -207,18 +210,18 @@ public class DownloadChapterFromMangaconnectorWorker(MangaConnectorId<Chapter> c
if (e is UnknownImageFormatException or NotSupportedException) if (e is UnknownImageFormatException or NotSupportedException)
{ {
//If the Image-Format is not processable by ImageSharp, we can't modify it. //If the Image-Format is not processable by ImageSharp, we can't modify it.
Log.Debug($"Unable to process image: Not supported image format"); Log.Debug("Unable to process image: Not supported image format");
}else if (e is InvalidImageContentException) }else if (e is InvalidImageContentException)
{ {
Log.Debug($"Unable to process image: Invalid Content"); Log.Debug("Unable to process image: Invalid Content");
} }
else else
{ {
Log.Error(e); Log.Error(e);
} }
}
return false; return false;
} }
}
private async Task CopyCoverFromCacheToDownloadLocation(Manga manga) private async Task CopyCoverFromCacheToDownloadLocation(Manga manga)
{ {