Methods
# async createCaptcha(width, height, optionopt)
Create custom captcha from scratch.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
width |
number | Width of captcha image. |
|
height |
number | Height of captcha image. |
|
option |
CreateCaptchaOptions |
<optional> |
Captcha text. |
# createCaptchaSync(width, height, optionopt)
Create captcha in sync mode.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
width |
number | captcha image width. |
|
height |
number | captcha image height. |
|
option |
CreateCaptchaOptions |
<optional> |
Captcha text. |
Type Definitions
# CreateCaptchaOptions
Create captcha options in functions.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
captcha |
SetCaptchaOptions |
<optional> |
Captcha text options to customise text appearance and value. |
decoy |
SetDecoyOptions |
<optional> |
|
trace |
SetTraceOptions |
<optional> |
|
background |
Image |
<optional> |
# DrawCaptchaOption
Captcha text options to customise text appearance and value.
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
text |
string |
<optional> |
"Random UpperCase string" | Text of captcha |
color |
hexCode |
<optional> |
"#32cf7e" | Color of captcha text. |
font |
font |
<optional> |
"Sans" | Font of captcha text. |
skew |
boolean |
<optional> |
true | Skew captcha text. |
colors |
array |
<optional> |
[] | Array of hexCode will override color property. |
rotate |
number |
<optional> |
5 | Range of angle to rotate text. |
size |
number |
<optional> |
40 | Size of captcha text. |
opacity |
float |
<optional> |
1 | Opcaity of captcha text. |
# SetCaptchaOptions
Captcha text options to customise text appearance and value.
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
characters |
integer |
<optional> |
6 | Length of captcha text. |
text |
string |
<optional> |
"Random UpperCase string" | Text of captcha |
color |
hexCode |
<optional> |
"#32cf7e" | Color of captcha text. |
font |
font |
<optional> |
"Sans" | Font of captcha text. |
skew |
boolean |
<optional> |
true | Skew captcha text. |
colors |
array |
<optional> |
[] | Array of hexCode will override color property. |
rotate |
number |
<optional> |
5 | Range of angle to rotate text. |
size |
number |
<optional> |
40 | Size of captcha text. |
opacity |
float |
<optional> |
1 | Opcaity of captcha text. |
# SetDecoyOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
color |
hexCode |
<optional> |
"#646566" | Color of decoy characters. |
font |
font |
<optional> |
"Sans" | Font of decoy characters. |
size |
number |
<optional> |
20 | Size of decoy characters. |
opacity |
float |
<optional> |
0.8 | Opacity of decoy characters. |
total |
number |
<optional> |
Total count of decoy characters. |
# SetDimensionOption
Customise dimension of captcha image.
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
height |
integer |
<optional> |
100 | Height of captcha image. |
width |
integer |
<optional> |
300 | Width of captcha image. |
# SetTraceOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
color |
hexCode |
<optional> |
"#32cf7e" | Color of trace line. |
size |
number |
<optional> |
3 | Width of trace line. |
opacity |
float |
<optional> |
1 | Opacoty of trace line. |