Bladeren bron

update images

Luke Pulverenti 8 jaren geleden
bovenliggende
commit
4569b6b491

+ 11 - 0
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))

+ 10 - 0
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);

+ 4 - 0
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>