aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing/ImageProcessor.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-07-25 14:32:03 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-07-25 14:32:03 -0400
commita46840534f943100e22fd869c5c30d4b5516dc1d (patch)
tree961fcfd572b235e5d6e3c714c5f8c3890d7b6ca6 /Emby.Drawing/ImageProcessor.cs
parentfe82a8a872d51fd57f7f6d91d1086d6669e01051 (diff)
3.2.26.3
Diffstat (limited to 'Emby.Drawing/ImageProcessor.cs')
-rw-r--r--Emby.Drawing/ImageProcessor.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index be4591223..88ead3a5f 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -171,6 +171,13 @@ namespace Emby.Drawing
return _imageEncoder.SupportedOutputFormats;
}
+ private static readonly string[] TransparentImageTypes = new string[] { ".png", ".webp" };
+ private bool SupportsTransparency(string path)
+ {
+ return TransparentImageTypes.Contains(Path.GetExtension(path) ?? string.Empty);
+ ;
+ }
+
public async Task<Tuple<string, string, DateTime>> ProcessImage(ImageProcessingOptions options)
{
if (options == null)
@@ -260,6 +267,11 @@ namespace Emby.Drawing
item = _libraryManager().GetItemById(options.ItemId);
}
+ if (options.CropWhiteSpace && !SupportsTransparency(originalImagePath))
+ {
+ options.CropWhiteSpace = false;
+ }
+
var resultPath = _imageEncoder.EncodeImage(originalImagePath, dateModified, tmpPath, autoOrient, orientation, quality, options, outputFormat);
if (string.Equals(resultPath, originalImagePath, StringComparison.OrdinalIgnoreCase))