Skip to content

Commit

Permalink
v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
supine0703 committed Aug 6, 2024
1 parent baad735 commit 6f6f915
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 32 deletions.
44 changes: 31 additions & 13 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ This is a fork of the [picgo-plugin-compress-webp-lossless](https://github.com/
#### Configuration
- Compress Type (A detailed comparative analysis table will be made later):
- [tinypng](https://tinypng.com/): Damaged compression, need to upload to tinypng.
- [imagemin](https://github.com/imagemin/imagemin): Local lossy compression.
- imagemin-webp: Local lossy compression to webp, support GIF lossy compression.
- [imagemin](https://github.com/imagemin/imagemin): Image compression does not change the suffix, support `jpeg` and `png`. Use [mozjpeg](https://www.npmjs.com/package/imagemin-mozjpeg) and [upng](https://www.npmjs.com/package/imagemin-upng).
- [imagemin-webp](https://www.npmjs.com/package/imagemin-webp): Local compression to webp.
Note: Some beds (such as sm.ms) do not support webp image format and will fail to upload.
- [webp-converter](https://www.npmjs.com/package/webp-converter): Local lossy compression to webp, support GIF lossy compression, smaller size, faster.
- [webp-converter](https://www.npmjs.com/package/webp-converter): Same as the last one.
- Gif Compress Type:
- webp-converter: Local lossy compresses gif to webp.
- imagemin-gif2webp:
- [webp-converter](https://www.npmjs.com/package/webp-converter): Local lossy compresses gif to webp.
- [imagemin-gif2webp](https://www.npmjs.com/package/imagemin-gif2webp):
- Auto Refresh TinyPng Key Across Months:
- yes: The TinyPng API Key status is automatically refreshed if it is detected to be across months (different from the last time it was used).
- no: No detection, but still record the date.
Expand All @@ -41,6 +41,11 @@ This is a fork of the [picgo-plugin-compress-webp-lossless](https://github.com/
- Separated by comma(`,`), multiple keys can be used to superimpose the usage times.


##### Compression parameter configuration

Go to see [option.example.json](./docs/option.example.json)



# ⚗️ Background

Expand All @@ -67,7 +72,7 @@ So there is ***`picgo-plugin-compress-next`*** birth 🎉
<th rowspan=5>TinyPng</th>
<td>✅</td>
<td>version >= <b>2.3.1</b></td>
<td></td>
<td>🟡</td>
<td>Highest version <b>2.3.0</b></td>
</tr>
<tr>
Expand Down Expand Up @@ -121,25 +126,25 @@ So there is ***`picgo-plugin-compress-next`*** birth 🎉
</td>
</tr>
<tr>
<th rowspan=3>imagemin</th>
<th rowspan=4>imagemin</th>
<td>✅</td>
<td>
<b>mozjpeg</b>:<br>
Support for local lossy conversion
<b>mozjpeg</b> & <b>upng</b>:<br>
Can configure compression parameters
</td>
<td></td>
<td>🟡</td>
<td>
<b>mozjpeg</b>:<br>
<b>mozjpeg</b> & <b>upng</b>:<br>
Support for local lossy conversion
</td>
</tr>
<tr>
<td>✅</td>
<td>
<b>imagemin-webp</b>:<br>
Supports local lossy conversion to <b>webp</b>
Can configure compression parameters
</td>
<td></td>
<td>🟡</td>
<td>
<b>imagemin-webp</b>:<br>
Supports local lossy conversion to <b>webp</b>
Expand All @@ -154,6 +159,12 @@ So there is ***`picgo-plugin-compress-next`*** birth 🎉
<td>❌</td>
<td>Conversion from gif to webp is not supported</td>
</tr>
<tr>
<td>✅</td>
<td>Multiple sets of compression configuration parameters are prepared, and you can configure them yourself</td>
<td>❌</td>
<td>Fixed preset parameters</td>
</tr>
<tr>
<th rowspan=2>webp-converter</th>
<td>✅</td>
Expand Down Expand Up @@ -188,6 +199,13 @@ So there is ***`picgo-plugin-compress-next`*** birth 🎉
- [x] Add ability of `gift 2 webp`
- [x] Use `webp-converter`'s `gwebp`
- [x] `imagemin-gif2webp`
- [x] Can set compression parameters based on your requirements
- [x] `imagemin-upng`
- [x] `imagemin-mozjpeg`
- [x] `imagemin-webp`
- [x] `imagemin-gif2webp`
- [x] `webp-converter-cwebp`
- [x] `webp-converter-gwebp`


# Reporting Issues
Expand Down
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,23 @@
#### 参数配置
- Compress Type (过段时间会制作详细对比分析表):
- [tinypng](https://tinypng.com/): 无损压缩,需要上传到 tinypng
- [imagemin](https://github.com/imagemin/imagemin): 本地有损压缩
- imagemin-webp: 本地有损压缩为 webp,支持 GIF 格式有损压缩
- [imagemin](https://github.com/imagemin/imagemin): 图片压缩不改变后缀名,支持 `jpeg``png`,使用 [mozjpeg](https://www.npmjs.com/package/imagemin-mozjpeg)[upng](https://www.npmjs.com/package/imagemin-upng)
- [imagemin-webp](https://www.npmjs.com/package/imagemin-webp): 本地压缩为 webp
注意:有些图床(比如 sm.ms)不支持 webp 图片格式,会上传失败
- [webp-converter](https://www.npmjs.com/package/webp-converter): 本地有损压缩为 webp,支持 GIF 格式有损压缩,体积更小,速度更快
- [webp-converter](https://www.npmjs.com/package/webp-converter): 同上
- Gif Compress Type:
- webp-converter: 本地有损将 gif 压缩为 webp
- imagemin-gif2webp:
- [webp-converter](https://www.npmjs.com/package/webp-converter): 本地有损将 gif 压缩为 webp
- [imagemin-gif2webp](https://www.npmjs.com/package/imagemin-gif2webp):
- Auto Refresh TinyPng Key Across Months:
- yes: 检测到跨月(与上次使用时年月不同)则自动刷新 TinyPng API Key 的状态
- no: 不检测,但是仍然记录年月
- TinyPng API Key:
-[developers](https://tinypng.com/developers) 中申请
- 逗号`,`隔开,可使用多个 Key 叠加使用次数

##### 压缩参数配置

参考 [option.example.json](./docs/option.example.json)


# ⚗️ 背景
Expand Down Expand Up @@ -67,7 +70,7 @@
<th rowspan=5>TinyPng</th>
<td>✅</td>
<td>version >= <b>2.3.1</b></td>
<td></td>
<td>🟡</td>
<td>最高 version <b>2.3.0</b></td>
</tr>
<tr>
Expand Down Expand Up @@ -121,25 +124,25 @@
</td>
</tr>
<tr>
<th rowspan=3>imagemin</th>
<th rowspan=4>imagemin</th>
<td>✅</td>
<td>
<b>mozjpeg</b>:<br>
支持本地有损压缩
<b>mozjpeg</b> & <b>upng</b>:<br>
可以自行配置压缩参数
</td>
<td></td>
<td>🟡</td>
<td>
<b>mozjpeg</b>:<br>
<b>mozjpeg</b> & <b>upng</b>:<br>
支持本地有损压缩
</td>
</tr>
<tr>
<td>✅</td>
<td>
<b>imagemin-webp</b>:<br>
支持本地有损转换为 <b>webp</b>
可以自行配置压缩参数
</td>
<td></td>
<td>🟡</td>
<td>
<b>imagemin-webp</b>:<br>
支持本地有损转换为 <b>webp</b>
Expand All @@ -149,21 +152,30 @@
<td>✅</td>
<td>
<b>imagemin-gif2webp</b>:<br>
支持 <b>gif</b> 本地有损转换为 <b>webp</b>
<b>gif</b> 转换为 <b>webp</b>,可自行配置参数
</td>
<td>❌</td>
<td>不支持 gif 转 webp</td>
</tr>
<tr>
<td>✅</td>
<td>准备了多套压缩配置参数,可自行配置</td>
<td>❌</td>
<td>固定的提前设置好的参数</td>
</tr>
<tr>
<th rowspan=2>webp-converter</th>
<td>✅</td>
<td>jpeg, png, webp 压缩为 <b>webp</b></td>
<td>
jpeg, png, webp 压缩为 <b>webp</b><br>
可自行配置参数
</td>
<td rowspan=2>❌</td>
<td rowspan=2>不支持使用 webp-converter</td>
</tr>
<tr>
<td>✅</td>
<td>支持 gif 压缩为 <b>webp</b></td>
<td>gif 压缩为 <b>webp</b>,可自行配置参数</td>
</tr>
<!-- <tr>
<td>✅</td>
Expand All @@ -184,10 +196,20 @@
- [x] 刷新有效 `Key`
- [x] 刷新所有 `Key`
- [x] 跨越份自动刷新有效 `Key`
- [x] 加入 `webp-converter` (更小的体积和更快的速度)
- [x] 加入 `webp-converter`
- [x] 加入 `gift 2 webp` 的能力
- [x] 使用 `webp-converter``gwebp`
- [x] `imagemin-gif2webp`
- [x] 可以根据自身需求配置压缩的具体参数
- [x] `imagemin-upng`
- [x] `imagemin-mozjpeg`
- [x] `imagemin-webp`
- [x] `imagemin-gif2webp`
- [x] `webp-converter-cwebp`
- [x] `webp-converter-gwebp`

# 压缩比较
> TODO ... ...

# 报告问题
Expand Down
74 changes: 74 additions & 0 deletions docs/option.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"reset": "not",
"warn": [
"Do not modify this file unless you know what you are doing.",
"If you modify or delete the `reset` option, the file will be reset the next time it is accessed",
"You can use the url below to learn how to configure"
],
"module": {
"imagemin-upng": {
"url": "https://www.npmjs.com/package/imagemin-upng#api",
"option": { "cnum": 256 },
"recommend": [{ "cnum": 0 }, { "cnum": 2048 }, { "cnum": 1024 }, { "cnum": 512 }, { "cnum": 256 }],
"annotation": [
"The cnum option is the number of colors in the palette (0=lossless). ",
"The larger the cnum value, the richer the color, the larger the file."
]
},
"imagemin-mozjpeg": {
"url": "https://www.npmjs.com/package/imagemin-mozjpeg#api",
"option": { "quality": 75, "progressive": true },
"recommend": [
{ "quality": 85, "progressive": true, "tune": "ms-ssim" },
{ "quality": 65, "progressive": true, "tune": "hvs-psnr" },
{ "quality": 45, "progressive": true, "trellis": false, "trellisDC": false }
],
"annotation": ["The smaller the mass, the larger the unit block"]
},
"imagemin-webp": {
"url": "https://www.npmjs.com/package/imagemin-webp#api",
"option": { "quality": 80, "method": 6 },
"recommend": [
{ "method": 6, "lossless": true, "autoFilter": true },
{ "quality": 100, "method": 6 },
{ "quality": 90, "method": 6 },
{ "quality": 80, "method": 6 },
{ "quality": 70, "method": 6 }
],
"annotation": [
"Lossless compression of detailed images, webp volume will be greatly improved.",
"The imagemin-webp and the webp-converter-cwebp use the same webp converter",
"-af === autoFilter"
]
},
"imagemin-gif2webp": {
"url": "https://www.npmjs.com/package/imagemin-gif2webp#api",
"option": { "quality": 80, "method": 6, "lossy": true, "minimize": true },
"recommend": [
{ "quality": 70, "method": 6, "lossy": true },
{ "quality": 60, "method": 6, "lossy": true }
]
},
"webp-converter-cwebp": {
"url": "https://developers.google.com/speed/webp/docs/cwebp",
"option": "-q 80 -m 6 -mt -af",
"recommend": [
"-lossless -m 6 -mt",
"-q 100 -m 6 -mt -af",
"-q 90 -m 6 -mt -af",
"-q 80 -m 6 -mt -af",
"-q 70 -m 6 -mt -af"
],
"annotation": [
"Lossless compression of detailed images, webp volume will be greatly improved.",
"The imagemin-webp and the webp-converter-cwebp use the same webp converter",
"-af === autoFilter"
]
},
"webp-converter-gwebp": {
"url": "https://developers.google.com/speed/webp/docs/gif2webp",
"option": "-q 80 -m 6 -lossy -min_size",
"recommend": ["-q 70 -m 6 -lossy", "-q 60 -m 6 -lossy"]
}
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f6f915

Please sign in to comment.