In case it helps someone in the future, I have found another solution that is much faster than Magick.NET (in processing the same gif, it takes only 3s instead of 50-60s than Magick.NET takes)
PhotoSauce.MagicScaler (Only work with Windows (.NET Core and .NET 5+) and partially works on Linux)
Example:
MagicImageProcessor.ProcessImage(@"\img\big.jpg", @"\img\small.jpg", new ProcessImageSettings { Width = 400 });
Resize with Bytes (Tested with png, jpg and gif):
public static byte[] ResizeImageBytes(byte[] imageBytes, int newWidth, int newHeight) {
using (MemoryStream outStream = new()) {
ProcessImageSettings processImageSettings = new() {
Width = newWidth,
Height = newHeight,
ResizeMode = CropScaleMode.Stretch,
HybridMode = HybridScaleMode.Turbo
};
MagicImageProcessor.ProcessImage(imageBytes, outStream, processImageSettings);
return outStream.ToArray();
}
}