[backend/drive] Fix ImageSharp image scaling for horizontal images

This commit is contained in:
Laura Hausmann 2024-08-14 21:15:33 +02:00
parent 1637064d60
commit 8889510811
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -106,12 +106,12 @@ public class ImageSharpProcessor : ImageProcessorBase, IImageProcessor
}
private Image<TPixel> GetImage<TPixel>(
byte[] data, IImageInfo ident, int width, int? height = null, bool preferContiguous = false
byte[] data, IImageInfo ident, int targetWidth, int? targetHeight = null, bool preferContiguous = false
) where TPixel : unmanaged, IPixel<TPixel>
{
width = Math.Min(ident.Width, width);
height = Math.Min(ident.Height, height ?? width);
var size = new Size(width, height.Value);
var width = Math.Min(ident.Width, targetWidth);
var height = Math.Min(ident.Height, targetHeight ?? targetWidth);
var size = new Size(width, height);
var options = new DecoderOptions
{
MaxFrames = 1,