diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-01-21 11:53:03 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-01-21 11:53:03 -0500 |
| commit | f380ddc5589e35da966833d3b8a6f073f369b38b (patch) | |
| tree | 3b068f73e7a6c12ef1bc7f77b86adf7deb245bc9 /Emby.Drawing/ImageProcessor.cs | |
| parent | faa9127a2081f40433b54795422dad10bb1bba9c (diff) | |
use image magick for auto-orientation
Diffstat (limited to 'Emby.Drawing/ImageProcessor.cs')
| -rw-r--r-- | Emby.Drawing/ImageProcessor.cs | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 9de6d2042..e01612700 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -257,7 +257,7 @@ namespace Emby.Drawing imageProcessingLockTaken = true; - _imageEncoder.EncodeImage(originalImagePath, cacheFilePath, GetRotationAngle(options.Item), newWidth, newHeight, quality, options, outputFormat); + _imageEncoder.EncodeImage(originalImagePath, cacheFilePath, AutoOrient(options.Item), newWidth, newHeight, quality, options, outputFormat); } return new Tuple<string, string>(cacheFilePath, GetMimeType(outputFormat, cacheFilePath)); @@ -281,35 +281,32 @@ namespace Emby.Drawing } } - private int GetRotationAngle(IHasImages item) + private bool AutoOrient(IHasImages item) { var photo = item as Photo; if (photo != null && photo.Orientation.HasValue) { - switch (photo.Orientation.Value) - { - case ImageOrientation.TopLeft: - return 0; - case ImageOrientation.TopRight: - return 0; - case ImageOrientation.BottomLeft: - return 270; - case ImageOrientation.BottomRight: - return 180; - case ImageOrientation.LeftBottom: - return -90; - case ImageOrientation.LeftTop: - return 0; - case ImageOrientation.RightBottom: - return 0; - case ImageOrientation.RightTop: - return 90; - } + return true; } - return 0; + return false; } + //private static int[][] OPERATIONS = new int[][] { + // TopLeft + //new int[] { 0, NONE}, + // TopRight + //new int[] { 0, HORIZONTAL}, + //new int[] {180, NONE}, + // LeftTop + //new int[] { 0, VERTICAL}, + //new int[] { 90, HORIZONTAL}, + // RightTop + //new int[] { 90, NONE}, + //new int[] {-90, HORIZONTAL}, + //new int[] {-90, NONE}, + //}; + private string GetMimeType(ImageFormat format, string path) { if (format == ImageFormat.Bmp) |
