aboutsummaryrefslogtreecommitdiff
path: root/Emby.Drawing/GDI/GDIImageEncoder.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-11-12 14:26:02 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-11-12 14:26:02 -0500
commit90e06289dc8a9b97fc48ee136eade94616de1ad6 (patch)
tree8ecf6d82b53011502fbb840db9ed4328aabbaeea /Emby.Drawing/GDI/GDIImageEncoder.cs
parent4da6275de121c7f8f1d82100588173039e8d0824 (diff)
update image encoding
Diffstat (limited to 'Emby.Drawing/GDI/GDIImageEncoder.cs')
-rw-r--r--Emby.Drawing/GDI/GDIImageEncoder.cs12
1 files changed, 5 insertions, 7 deletions
diff --git a/Emby.Drawing/GDI/GDIImageEncoder.cs b/Emby.Drawing/GDI/GDIImageEncoder.cs
index 530613741..3df84cf11 100644
--- a/Emby.Drawing/GDI/GDIImageEncoder.cs
+++ b/Emby.Drawing/GDI/GDIImageEncoder.cs
@@ -32,7 +32,7 @@ namespace Emby.Drawing.GDI
{
using (var img = Image.FromStream(stream))
{
-
+
}
}
_logger.Info("GDIImageEncoder started");
@@ -79,17 +79,17 @@ namespace Emby.Drawing.GDI
{
using (var croppedImage = image.CropWhitespace())
{
- _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
using (var outputStream = _fileSystem.GetFileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.Read, false))
{
croppedImage.Save(System.Drawing.Imaging.ImageFormat.Png, outputStream, 100);
}
- }
+ }
}
}
- public void EncodeImage(string inputPath, string cacheFilePath, int width, int height, int quality, ImageProcessingOptions options)
+ public void EncodeImage(string inputPath, string cacheFilePath, int width, int height, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
var hasPostProcessing = !string.IsNullOrEmpty(options.BackgroundColor) || options.UnplayedCount.HasValue || options.AddPlayedIndicator || options.PercentPlayed > 0;
@@ -98,8 +98,6 @@ namespace Emby.Drawing.GDI
var newWidth = Convert.ToInt32(width);
var newHeight = Convert.ToInt32(height);
- var selectedOutputFormat = options.OutputFormat;
-
// Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here
// Also, Webp only supports Format32bppArgb and Format32bppRgb
var pixelFormat = selectedOutputFormat == ImageFormat.Webp
@@ -133,7 +131,7 @@ namespace Emby.Drawing.GDI
var outputFormat = GetOutputFormat(originalImage, selectedOutputFormat);
- _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
// Save to the cache location
using (var cacheFileStream = _fileSystem.GetFileStream(cacheFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, false))