Skip to content

Commit 0bb74db

Browse files
committed
Add CLI Mode & Optimize Performance
1 parent 6001730 commit 0bb74db

File tree

5 files changed

+207
-106
lines changed

5 files changed

+207
-106
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@
2929
*.log
3030

3131
# ide
32-
.idea/
32+
.idea/
33+
34+
build/

README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ Compressor can properly handle the task of compressing a large number of picture
2323

2424
# Usage
2525

26-
## Default
27-
28-
Compress the picture into **jpg** format
26+
**Default** compress the picture into `jpg` format
2927

3028
Output quality **90%**
3129

@@ -44,27 +42,50 @@ D:\\Pictures\\myimg\\test.png -> D:\\Pictures_231453823\\myimg\\test.jpg
4442
D:\\Pictures\\mypic\\hahaha.png -> D:\\Pictures_231453823\\mypic\\hahaha.jpg
4543
```
4644

45+
## Run
4746

47+
Download the release and configure
4848

49-
## Modify Configuration
50-
51-
Modify the file `config.json` directly
49+
```bash
50+
# Specify configuration
51+
compressor -c config.json
5252

53+
# CLI Mode
54+
# 8 threads; quality 80; input path ~/Pictures
55+
compressor -i ~/Pictures -j 8 -q 80
5356

57+
# full usage
58+
compressor -h
59+
```
5460

55-
## Run
61+
## Full Usage
5662

57-
Download the release and configure
63+
```
64+
Version: 2.x
65+
Usage: compressor [-h] [Options]
66+
67+
Options:
68+
-h
69+
show this help
70+
-c string
71+
Configuration Filepath
72+
-f string
73+
Input Format (default "jpg jpeg png")
74+
-i string
75+
Input Path
76+
-j int
77+
Thread Count (default 4)
78+
-o string
79+
Output Path
80+
-q int
81+
JPEG Quality (default 90)
82+
```
5883

59-
```bash
60-
# No argument, using config.json under the relative path
61-
compressor
6284

63-
# Specify configuration
64-
compressor -c another_config.json
65-
```
6685

86+
## Modify Configuration
6787

88+
Modify the file `config.json` directly
6889

6990
# Configuration Description
7091

README_zh_CN.md

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ compressor 可以妥善处理好**将大批量图片压缩成为JPG格式**的
1919
- 异常处理
2020
- 跨平台支持
2121

22-
# 用法
22+
# 使用方法
2323

24-
## 默认的参数配置
25-
26-
将图片压缩为 **jpg** 格式
24+
**默认**将图片压缩为 `jpg` 格式
2725

2826
输出质量 **90%**
2927

@@ -42,27 +40,48 @@ D:\\Pictures\\myimg\\test.png -> D:\\Pictures_231453823\\myimg\\test.jpg
4240
D:\\Pictures\\mypic\\hahaha.png -> D:\\Pictures_231453823\\mypic\\hahaha.jpg
4341
```
4442

45-
46-
47-
## 修改参数
48-
49-
直接修改 `config.json` 文件
50-
51-
52-
5343
## 启动
5444

5545
下载对应 Release 并配置
5646

5747
```bash
58-
# 无参数,使用相对路径下的 config.json
59-
compressor
60-
6148
# 指定配置文件
62-
compressor -c another_config.json
49+
compressor -c config.json
50+
51+
# CLI 模式
52+
# 8 线程; 质量 80; 输入路径 ~/Pictures
53+
compressor -i ~/Pictures -j 8 -q 80
54+
55+
# 完整用法
56+
compressor -h
6357
```
6458

59+
## 完整用法
6560

61+
```
62+
Version: 2.x
63+
Usage: compressor [-h] [Options]
64+
65+
Options:
66+
-h
67+
show this help
68+
-c string
69+
Configuration Filepath
70+
-f string
71+
Input Format (default "jpg jpeg png")
72+
-i string
73+
Input Path
74+
-j int
75+
Thread Count (default 4)
76+
-o string
77+
Output Path
78+
-q int
79+
JPEG Quality (default 90)
80+
```
81+
82+
## 修改参数
83+
84+
直接修改 `config.json` 文件
6685

6786
# 配置文件说明
6887

0 commit comments

Comments
 (0)