C#调用百度图像识别出image format error[图像格式错误]是怎么回事

在C#窗体应用程序中使用pictruebox控件装了一个图片
var picclient = new Baidu.Aip.ImageClassify.ImageClassify("key", "key")
{
Timeout = 60000 // 修改超时时间
};
var picclient = new Baidu.Aip.ImageClassify.ImageClassify("NpBGfUR6qBGtFo5bIFbiPCO9", "S0L7LXAewfW7BBKmbXd0EQ8iRzEYRGqc")
{
Timeout = 60000 // 修改超时时间
};

                Image img = this.picbPreview.Image;
                BinaryFormatter binFormatter = new BinaryFormatter();
                MemoryStream memStream = new MemoryStream();
                binFormatter.Serialize(memStream, img);
                byte[] bytes = memStream.ToArray();
                var picoptions = new Dictionary<string, object> { };

                var results = picclient.AdvancedGeneral(bytes, picoptions);
                if (results != null && results.ToString() != null && results.ToString().Length > 0)
                {

                    var json = JsonConvert.SerializeObject(results);
                    ImageRecognitionModel model = DeserializeJsonToObject<ImageRecognitionModel>(json) ?? new ImageRecognitionModel();
                    ImageRecognitionBind(model);
                }

结果返回的是图像格式错误,会不会是转base64编码有问题,求大神解答

假如我给一个按钮,打开选择文件,选中一个图片,获取到图片路径
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
string _path = ofd.FileName;
var picclient = new Baidu.Aip.ImageClassify.ImageClassify("key", key"")
{
Timeout = 60000 // 修改超时时间
};

        var image = File.ReadAllBytes(_path);


        var picoptions = new Dictionary<string, object> { };

        var results = picclient.AdvancedGeneral(image, picoptions);
        if (results != null && results.ToString() != null && results.ToString().Length > 0)
        {

            var json = JsonConvert.SerializeObject(results);
            ImageRecognitionModel model = DeserializeJsonToObject<ImageRecognitionModel>(json) ?? new ImageRecognitionModel();
            ImageRecognitionBind(model);
        }
                    这样是能正确获取到数据的,appkey我没有放出来,请见谅

图片格式必须是jpg,必须正确编码,如果还不行,建议联系百度技术支持,也不排除他们的服务不稳定。