update images

This commit is contained in:
Luke Pulverenti 2017-05-09 16:18:02 -04:00
parent 34c3783f42
commit 4569b6b491
3 changed files with 25 additions and 0 deletions

View file

@ -95,6 +95,8 @@ namespace Emby.Drawing.Skia
{ {
// @todo // @todo
} }
_fileSystem.CopyFile(inputPath, outputPath, true);
} }
public ImageSize GetImageSize(string path) 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) 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 bitmap = SKBitmap.Decode(inputPath))
{ {
using (var resizedBitmap = new SKBitmap(width, height, bitmap.ColorType, bitmap.AlphaType)) using (var resizedBitmap = new SKBitmap(width, height, bitmap.ColorType, bitmap.AlphaType))

View file

@ -2,6 +2,7 @@
using Emby.Drawing; using Emby.Drawing;
using Emby.Drawing.Net; using Emby.Drawing.Net;
using Emby.Drawing.ImageMagick; using Emby.Drawing.ImageMagick;
using Emby.Drawing.Skia;
using Emby.Server.Core; using Emby.Server.Core;
using Emby.Server.Implementations; using Emby.Server.Implementations;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
@ -23,6 +24,15 @@ namespace MediaBrowser.Server.Startup.Common
{ {
if (!startupOptions.ContainsOption("-enablegdi")) 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 try
{ {
return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem); return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);

View file

@ -1112,6 +1112,10 @@
<Project>{c97a239e-a96c-4d64-a844-ccf8cc30aecb}</Project> <Project>{c97a239e-a96c-4d64-a844-ccf8cc30aecb}</Project>
<Name>Emby.Drawing.Net</Name> <Name>Emby.Drawing.Net</Name>
</ProjectReference> </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"> <ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj">
<Project>{08fff49b-f175-4807-a2b5-73b0ebd9f716}</Project> <Project>{08fff49b-f175-4807-a2b5-73b0ebd9f716}</Project>
<Name>Emby.Drawing</Name> <Name>Emby.Drawing</Name>