-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.js
75 lines (71 loc) · 2.51 KB
/
index.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import inquirer from 'inquirer'
import fs from 'fs'
import Questions from './questions'
import FileUtils from './FileUtils'
import gm from 'gm'
gm.subClass({ imageMagick: true });
// gm('/home/oguzhan/Pictures/foto.jpg')
// // .blur(10,5)
// // .chop(500, 500, 100, 10)
// .borderColor('#444')
// .border(20, 20)
// // .charcoal(1)
// // .colorize(12, 50, 60)
// // .colors(100)
// // .crop(600, 300, 20, 20)
// // .flip()
// // .flop()
// // .frame(20, 20, 10, 10)
// // .gamma(12,1,35)
// // .geometry(600, 500, '%')
// // .gravity('Center')
// // .highlightColor('red')
// // .fuzz()
// // .gaussian(12)
// // .channel('Opacity')
// // .append('/home/oguzhan/Pictures/icon.png', true)
// // .watermark(23, 32)
// .stroke('red', 25)
// .fill('yellow')
// .drawRectangle(10, 20, 200, 200, )
// .fontSize(64)
// .fill('red')
// .drawText(20, 30, 'TEXT', 'CENTER')
// .write('/home/oguzhan/Pictures/foto2.jpg', err => console.log(err))
// process.exit()
inquirer.prompt([Questions.input_type])
.then(({ input_type }) => {
switch (input_type) {
case 'f':
inquirer.prompt([Questions.input_file_name, Questions.output_file_name])
.then(({ input_file_name, output_file_name }) => {
fs.existsSync(input_file_name, exists => {
if (exists) {
gm(input_file_name)
.resize(500, 240, '!')
.backdrop()
.write(output_file_name, err => console.log(err))
} else {
console.log('File not exists.')
}
})
})
break;
case 'd':
inquirer.prompt([Questions.dir_path])
.then(({ dir_path }) => {
try {
if (FileUtils.isDirectory(dir_path)) {
console.log(fs.readdirSync(dir_path))
}
} catch (err) {
console.log('Wrong path.')
}
})
/* inquirer.prompt([Questions.options])
.then(ans => {
console.log(ans)
}) */
break;
}
})