aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing/ImageProcessor.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-07-25 14:32:24 -0400
committerGitHub <noreply@github.com>2017-07-25 14:32:24 -0400
commitd23cb10bbffafa49914818d88c9189bceeee095f (patch)
tree961fcfd572b235e5d6e3c714c5f8c3890d7b6ca6 /Emby.Drawing/ImageProcessor.cs
parent1a550b1fa8b7c987d8f6f9d56b73f598aa17ae55 (diff)
parenta46840534f943100e22fd869c5c30d4b5516dc1d (diff)
Merge pull request #2775 from MediaBrowser/dev
Dev
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))