private void rb_reflash() { if (pic_Captcha_result.Image == null) { pic_Captcha_effect.Image = null; return; } Captcha obj = new Captcha(new Bitmap(pic_Captcha_result.Image)); if (rb_gray.Checked == true) { obj.ConvertGrayByPixels(comboBox_gray.SelectedIndex); } else if (rb_invert.Checked == true) { obj.InvertColorByPixels(); } else if (rb_bit.Checked == true) { obj.ConvertGrayToBlackByPixels(Int32.Parse(textBox_bit.Text)); } else if (rb_bright.Checked == true) { obj.AdjustBrightness(Int32.Parse(textBox_bright.Text)); } pic_Captcha_effect.Image = obj.BmpSource; }
private Captcha rb_taskEffect(Bitmap bmp) { Captcha tmp = new Captcha(bmp); for (int i = 0; i < listBox_task.Items.Count; i++) { string[] cmd = listBox_task.Items[i].ToString().Split(' '); switch (cmd[0]) { case "灰階化": tmp.ConvertGrayByPixels(Int32.Parse(cmd[1])); break; case "反轉顏色": tmp.InvertColorByPixels(); break; case "顏色二值化": tmp.ConvertGrayToBlackByPixels(Int32.Parse(cmd[1])); break; case "亮度調整": tmp.AdjustBrightness(Int32.Parse(cmd[1])); break; } } return(tmp); }
private void StartDEMO() { Navigate("https://nportal.ntut.edu.tw"); if (!Loading(WB, Int32.Parse(tb_TimeOut.Text))) { MessageBox.Show("連線逾時!"); return; } Image img = GetRegCodePic(WB, "", "", "authImage"); Captcha tmp = new Captcha(new Bitmap(img)); tmp.ConvertGrayByPixels(0); tmp.ConvertGrayToBlackByPixels(160); tmp.InvertColorByPixels(); SplitCaptcha(tmp, 4); WebFillIn(WB, text_id.Text, text_pw.Text, txt_p1.Text + txt_p2.Text + txt_p3.Text + txt_p4.Text); }