support null image encoder

This commit is contained in:
Luke Pulverenti
2015-10-26 01:29:32 -04:00
parent 2890c71af9
commit c80e1df1ca
24 changed files with 333 additions and 96 deletions

View File

@@ -9,7 +9,6 @@ using System;
using System.IO;
using System.Linq;
using CommonIO;
using MediaBrowser.Common.IO;
namespace Emby.Drawing.ImageMagick
{
@@ -27,7 +26,7 @@ namespace Emby.Drawing.ImageMagick
_httpClient = httpClient;
_fileSystem = fileSystem;
LogImageMagickVersion();
LogVersion();
}
public string[] SupportedInputFormats
@@ -68,7 +67,7 @@ namespace Emby.Drawing.ImageMagick
}
}
private void LogImageMagickVersion()
private void LogVersion()
{
_logger.Info("ImageMagick version: " + Wand.VersionString);
TestWebp();
@@ -88,9 +87,9 @@ namespace Emby.Drawing.ImageMagick
wand.SaveImage(tmpPath);
}
}
catch (Exception ex)
catch
{
_logger.ErrorException("Error loading webp: ", ex);
//_logger.ErrorException("Error loading webp: ", ex);
_webpAvailable = false;
}
}
@@ -255,5 +254,15 @@ namespace Emby.Drawing.ImageMagick
throw new ObjectDisposedException(GetType().Name);
}
}
public bool SupportsImageCollageCreation
{
get { return true; }
}
public bool SupportsImageEncoding
{
get { return true; }
}
}
}

View File

@@ -354,14 +354,14 @@ namespace Emby.Drawing.ImageMagick
private MagickWand BuildSquareCollageWand(List<string> paths, int width, int height)
{
var inputPaths = ImageHelpers.ProjectPaths(paths, 4);
var inputPaths = ImageHelpers.ProjectPaths(paths, 3);
using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
using (var draw = new DrawingWand())
{
var iSlice = Convert.ToInt32(width * .225);
var iSlice = Convert.ToInt32(width * .3);
int iTrans = Convert.ToInt32(height * .25);
int iHeight = Convert.ToInt32(height * .63);
var horizontalImagePadding = Convert.ToInt32(width * 0.02);