Код: Выделить всё
1.0
Код: Выделить всё
public IActionResult LoadImage(string imageName, double scaleFactor = 1.0)
{
if (imageName.IsNullOrEmpty())
{
return NotFound();
}
var imagePath = Path.Combine(_env.ContentRootPath, imageName);
var extension = Path.GetExtension(imagePath);
var contentType = MimeTypeMapping.GetMimeTypeFromExtension(extension);
var img = System.IO.File.OpenRead(imagePath);
var resizedImage = FileHelpers.ResizeImage(img, extension, scaleFactor);
return File(resizedImage, contentType);
}
Код: Выделить всё
public static Stream ResizeImage(Stream imgStream, string extension, double scaleFactor)
{
if (scaleFactor
Подробнее здесь: [url]https://stackoverflow.com/questions/77037401/skiasharp-scale-image-down-and-reduce-quality-and-hence-image-size[/url]