mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
process all images using Format32bppPArgb
This commit is contained in:
parent
3c06fc4d1a
commit
d18f000e88
@ -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
|
// 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
|
// Preserve the original resolution
|
||||||
thumbnail.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution);
|
thumbnail.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution);
|
||||||
@ -178,7 +178,7 @@ namespace MediaBrowser.Controller.Drawing
|
|||||||
thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
|
thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
|
||||||
thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
thumbnailGraph.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
thumbnailGraph.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
thumbnailGraph.CompositingMode = CompositingMode.SourceOver;
|
thumbnailGraph.CompositingMode = CompositingMode.SourceCopy;
|
||||||
|
|
||||||
thumbnailGraph.DrawImage(bmp,
|
thumbnailGraph.DrawImage(bmp,
|
||||||
new RectangleF(0, 0, croppedWidth, croppedHeight),
|
new RectangleF(0, 0, croppedWidth, croppedHeight),
|
||||||
|
@ -163,7 +163,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
|
|||||||
var newHeight = Convert.ToInt32(newSize.Height);
|
var newHeight = Convert.ToInt32(newSize.Height);
|
||||||
|
|
||||||
// Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here
|
// 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
|
// Preserve the original resolution
|
||||||
thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);
|
thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user