From d18f000e886feb878d94598441d98d86e499e3db Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 21 Oct 2013 10:32:58 -0400 Subject: [PATCH] process all images using Format32bppPArgb --- MediaBrowser.Controller/Drawing/ImageExtensions.cs | 4 ++-- MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/Drawing/ImageExtensions.cs b/MediaBrowser.Controller/Drawing/ImageExtensions.cs index 92b2ec8357..a7dbc701ff 100644 --- a/MediaBrowser.Controller/Drawing/ImageExtensions.cs +++ b/MediaBrowser.Controller/Drawing/ImageExtensions.cs @@ -167,7 +167,7 @@ namespace MediaBrowser.Controller.Drawing } // Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here - var thumbnail = bmp.PixelFormat == PixelFormat.Indexed ? new Bitmap(croppedWidth, croppedHeight) : new Bitmap(croppedWidth, croppedHeight, bmp.PixelFormat); + var thumbnail = new Bitmap(croppedWidth, croppedHeight, PixelFormat.Format32bppPArgb); // Preserve the original resolution thumbnail.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution); @@ -178,7 +178,7 @@ namespace MediaBrowser.Controller.Drawing thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality; thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic; thumbnailGraph.PixelOffsetMode = PixelOffsetMode.HighQuality; - thumbnailGraph.CompositingMode = CompositingMode.SourceOver; + thumbnailGraph.CompositingMode = CompositingMode.SourceCopy; thumbnailGraph.DrawImage(bmp, new RectangleF(0, 0, croppedWidth, croppedHeight), diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs index 4efb871768..95a6448023 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs @@ -163,7 +163,7 @@ namespace MediaBrowser.Server.Implementations.Drawing var newHeight = Convert.ToInt32(newSize.Height); // Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here - using (var thumbnail = !ImageExtensions.IsPixelFormatSupportedByGraphicsObject(originalImage.PixelFormat) ? new Bitmap(originalImage, newWidth, newHeight) : new Bitmap(newWidth, newHeight, originalImage.PixelFormat)) + using (var thumbnail = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppPArgb)) { // Preserve the original resolution thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);