/// <summary> /// 下载验证码图片 /// </summary> public void DownloadVerificationCodeImage() { string verificationCodeUrl = "https://kyfw.12306.cn/passport/captcha/captcha-image64?login_site=E&module=login"; string verificationCodeJson = HttpUtil.DoGet(verificationCodeUrl, cookieContainer); var verificationCodeResult = JsonConvert.DeserializeObject <VerificationCodeResult>(verificationCodeJson); FileUtil.Base64ToImageFile(verificationCodeResult.image, verificationCodePng); ImageUtil.RgbToGrayScale(verificationCodePng, verificationCodeGrayScalePng); }