2
var fileName = Path.Combine(filePath, $"{nameOnly}{ext}");

using (var stream = new FileStream(fileName, FileMode.Create))
{
    await formFile.CopyToAsync(stream);
    stream.Position = 0;
    ImageOptimizer optimizer = new ImageOptimizer() {
        OptimalCompression = true,
        IgnoreUnsupportedFormats =true
    };
    optimizer.Compress(stream);
}

I have an image 3.6MB and after compressed, it's 3.32MB, still too big.

I am looking for a size below 1MB.

Do we have any other way to future reduce its size?
I don't want to re-size btw.

GSerg
  • 76,472
  • 17
  • 159
  • 346
Franva
  • 6,565
  • 23
  • 79
  • 144

0 Answers0