“Parameter is not valid.” when using saving bitmap

后端 未结 2 676
后悔当初
后悔当初 2021-01-03 11:21

Im trying to save a bitmap jpg format with a specified encoding quality. However im getting an exception (\"Parameter is not valid.\") when calling the save method.

2条回答
  •  再見小時候
    2021-01-03 12:08

    You should cast quality value to long, like this:

    eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)16);
    

提交回复
热议问题