diff options
| -rw-r--r-- | Emby.Drawing.Skia/SkiaEncoder.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/ImageEncoderHelper.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj | 4 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index 2c2ae03b6..3c631aef0 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 ddbde2f66..8c3d8d213 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; @@ -25,6 +26,15 @@ namespace MediaBrowser.Server.Startup.Common { 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); } catch diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 7c3757f5f..d632007d2 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -1112,6 +1112,10 @@ <Project>{c97a239e-a96c-4d64-a844-ccf8cc30aecb}</Project> <Name>Emby.Drawing.Net</Name> </ProjectReference> + <ProjectReference Include="..\Emby.Drawing.Skia\Emby.Drawing.Skia.csproj"> + <Project>{2312da6d-ff86-4597-9777-bceec32d96dd}</Project> + <Name>Emby.Drawing.Skia</Name> + </ProjectReference> <ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj"> <Project>{08fff49b-f175-4807-a2b5-73b0ebd9f716}</Project> <Name>Emby.Drawing</Name> |
