-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.js
More file actions
31 lines (31 loc) · 841 Bytes
/
generator.js
File metadata and controls
31 lines (31 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var svgCaptcha = require('svg-captcha');
var fs = require('fs');
var svg2img = require('svg2img');
var num = 10000;//desired amount of captcha (10k is very good)
const FORMAT = 'webp';
const SIZE = [720, 360];
const out = './temp';
async function generate(){
// process.stdout.write(`\r${num} left `);
var captcha = svgCaptcha.create({
size: 4,
noise: 1,
color: true,
background: '#2E3137',
width: SIZE[0],
height: SIZE[1],
fontSize: 160
});
svg2img(captcha.data,{ format: FORMAT }, function(error, buffer) {
fs.writeFileSync(`${out}/${captcha.text}.${FORMAT}`, buffer);
console.log(`${out}/${captcha.text}.${FORMAT}`);
});
if (num > 1){
num--;
await generate();
}
}
async function main(){
await generate();
}
main();