Skip to content

Commit 07cea92

Browse files
committed
update:验证码加上了扭曲
1 parent b04a3a1 commit 07cea92

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/org/nutz/img/Images.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,11 @@ public static BufferedImage flipVertical(Object srcIm, File tarIm) {
585585
* @return 被扭曲后的图片
586586
*/
587587
public static BufferedImage twist(Object srcIm, double twistRank, String bgColor) {
588+
if (twistRank <= 0) {
589+
twistRank = 1;
590+
}
588591
BufferedImage bufImg = read(srcIm);
589-
double period = R.random(0, 7) + 3;// 波形的幅度倍数,越大扭曲的程序越高,一般为3
592+
double period = R.random(0, 10) + 3;// 波形的幅度倍数,越大扭曲的程序越高,一般为3
590593
double phase = R.random(0, 6);// 波形的起始相位,取值区间(0-2*PI)
591594
int width = bufImg.getWidth();
592595
int height = bufImg.getHeight();
@@ -1454,7 +1457,7 @@ public static BufferedImage createCaptcha(String content,
14541457
}
14551458

14561459
// 图像扭曲
1457-
1460+
im = twist(im, 1, bgColor);
14581461
return im;
14591462
}
14601463

0 commit comments

Comments
 (0)