How to resize a picture to a specific file size?

前端 未结 5 890
暗喜
暗喜 2020-12-17 15:12

I would like to resize a picture to a specific file size. For example, no more than 200KB. What is the best approach to achieve this with C# .NET ?

Thanks !

5条回答
  •  旧时难觅i
    2020-12-17 15:26

    A rough estimate is as follows:

    size(KB) = (width * height * bitdepth) / (8 * 1024)

    The file size is inflated a bit more due to file information (compression info, etc).

提交回复
热议问题