diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-10 15:56:59 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-10 15:56:59 -0400 |
| commit | 3c604453118e06f11052b10c672d726393996c34 (patch) | |
| tree | c3a4f91b16be38ca82c756bcaf7fa085b7276ef8 | |
| parent | b9baf377e81e454438d9faad1b1b793a719bb667 (diff) | |
update skia
| -rw-r--r-- | Emby.Drawing.Skia/SkiaEncoder.cs | 19 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/ImageEncoderHelper.cs | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index d52ad4734..64c2afe0e 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -192,17 +192,32 @@ namespace Emby.Drawing.Skia } } + private SKBitmap Decode(string path) + { + using (var stream = new SKFileStream(path)) + { + var codec = SKCodec.Create(stream); + + // create the bitmap + var bitmap = new SKBitmap(codec.Info.Width, codec.Info.Height); + // decode + codec.GetPixels(bitmap.Info, bitmap.GetPixels()); + + return bitmap; + } + } + private SKBitmap GetBitmap(string path, bool cropWhitespace) { if (cropWhitespace) { - using (var bitmap = SKBitmap.Decode(path)) + using (var bitmap = Decode(path)) { return CropWhiteSpace(bitmap); } } - return SKBitmap.Decode(path); + return Decode(path); } public void EncodeImage(string inputPath, string outputPath, bool autoOrient, int width, int height, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat) diff --git a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs index 99ccdbbe8..8c3d8d213 100644 --- a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs +++ b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs @@ -26,7 +26,7 @@ namespace MediaBrowser.Server.Startup.Common { try { - //return new SkiaEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem); + return new SkiaEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem); } catch { |
