#region 将图片转成深度1的黑白图 private unsafe void SaveTiff(Bitmap bmp) { ImageCodecInfo icf = GetEncoderInfo("image/tiff"); EncoderParameters iparams = new EncoderParameters(1); System.Drawing.Imaging.Encoder iparam = System.Drawing.Imaging.Encoder.Compression; EncoderParameter iparamPara = new EncoderParameter(iparam, (long)(EncoderValue.CompressionCCITT4)); iparams.Param[0] = iparamPara; bmp.Save(ExePath + @"\NewOut.tif", icf, iparams);//"参数无效" bmp.Dispose(); iparamPara.Dispose(); } #endregion private static ImageCodecInfo GetEncoderInfo(string mimeType) { int j; ImageCodecInfo[] encoders; encoders = ImageCodecInfo.GetImageDecoders(); for (j = 0; j < encoders.Length; j++) { if (encoders[j].MimeType == mimeType) return encoders[j]; } return null; }