diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs
index 2c2ae03b66..3c631aef07 100644
--- a/Emby.Drawing.Skia/SkiaEncoder.cs
+++ b/Emby.Drawing.Skia/SkiaEncoder.cs
@@ -95,6 +95,8 @@ namespace Emby.Drawing.Skia
{
// @todo
}
+
+ _fileSystem.CopyFile(inputPath, outputPath, true);
}
public ImageSize GetImageSize(string path)
@@ -118,6 +120,15 @@ namespace Emby.Drawing.Skia
public void EncodeImage(string inputPath, string outputPath, bool autoOrient, int width, int height, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
+ if (string.IsNullOrWhiteSpace(inputPath))
+ {
+ throw new ArgumentNullException("inputPath");
+ }
+ if (string.IsNullOrWhiteSpace(inputPath))
+ {
+ throw new ArgumentNullException("outputPath");
+ }
+
using (var bitmap = SKBitmap.Decode(inputPath))
{
using (var resizedBitmap = new SKBitmap(width, height, bitmap.ColorType, bitmap.AlphaType))
diff --git a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
index ddbde2f666..8c3d8d2130 100644
--- a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
+++ b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
@@ -2,6 +2,7 @@
using Emby.Drawing;
using Emby.Drawing.Net;
using Emby.Drawing.ImageMagick;
+using Emby.Drawing.Skia;
using Emby.Server.Core;
using Emby.Server.Implementations;
using MediaBrowser.Common.Configuration;
@@ -23,6 +24,15 @@ namespace MediaBrowser.Server.Startup.Common
{
if (!startupOptions.ContainsOption("-enablegdi"))
{
+ try
+ {
+ return new SkiaEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);
+ }
+ catch
+ {
+ logger.Error("Error loading ImageMagick. Will revert to GDI.");
+ }
+
try
{
return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 7c3757f5fa..d632007d20 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -1112,6 +1112,10 @@
{c97a239e-a96c-4d64-a844-ccf8cc30aecb}
Emby.Drawing.Net
+
+ {2312da6d-ff86-4597-9777-bceec32d96dd}
+ Emby.Drawing.Skia
+
{08fff49b-f175-4807-a2b5-73b0ebd9f716}
Emby.Drawing