From 8149ff2b12c94ae9f41d697890c55bb081700253 Mon Sep 17 00:00:00 2001 From: LinkChou Date: Mon, 9 Oct 2023 22:51:21 +0800 Subject: [PATCH 1/3] Reformat README and clearly introduct range of each opinion and give an example --- README.md | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 08d7671e..705dfbfc 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ cargo install rimage ## Usage -``` +```text Usage: rimage [OPTIONS] ... Arguments: @@ -42,28 +42,35 @@ Options: -V, --version Print version General: - -q, --quality Optimization quality [default: 75] - -f, --codec Image codec to use [default: mozjpeg] - -o, --output Write output file(s) to - -r, --recursive Saves output file(s) preserving folder structure - -s, --suffix [] Appends suffix to output file(s) names - -b, --backup Appends '.backup' to input file(s) names + -q, --quality Optimization quality + [default: 75, Range: 1-100] + -f, --codec Image codec to use + [default: mozjpeg] + -o, --output Write output file(s) to + -r, --recursive Saves output file(s) preserving folder structure + -s, --suffix [] Appends suffix to output file(s) names + -b, --backup Appends ".backup" to input file(s) names Quantization: - --quantization [] Enables quantization with optional quality [default: 75] - --dithering [] Enables dithering with optional quality [default: 75] + --quantization [] Enables quantization with optional quality + [default: 75, Range: 1-100] + --dithering [] Enables dithering with optional quality + [default: 75, Range: 1-100] Resizing: - --width Resize image with specified width - --height Resize image with specified height - --filter Filter used for image resizing [default: lanczos3] + --width Resize image with specified width + [Integer only] + --height Resize image with specified height + [Integer only] + --filter Filter used for image resizing + [default: lanczos3] ``` Note that image formats may wary from features that are used when building `rimage`. List of supported codecs with all features: -- `mozjpeg`, `jpeg`, `jpg` => mozjpeg codec +- `mozjpeg`, `jpeg`, `jpg` => **mozjpeg codec (common and small)** - `png` => browser png codec without compression - `oxipng` => oxipng codec with compression - `jpegxl`, `jxl` => jpeg xl codec @@ -78,6 +85,16 @@ List of available resize filters: - `mitchell` => Resize using Mitchell-Netravali filter - `lanczos3` => Resize using Sinc-windowed Sinc with radius of 3 +## Example + +|Image|Quality|Format|Dir|Backup| +|----|----|----|----|----| +|"D:\\Desktop\\input [text].png"|90|jpg|"D:\\Desktop\\OutputTest"|True| + +```sh +rimage.exe "D:\\Desktop\\input [text].png" -q 90 --codec jpg -o "D:\\Desktop\\OutputTest" -b +``` + ## Library Installation Add Rimage to your project with Cargo: From 041ea7ccd093b147eee093f1bcfd7962ff3963cd Mon Sep 17 00:00:00 2001 From: LinkChou Date: Tue, 10 Oct 2023 01:02:06 +0800 Subject: [PATCH 2/3] Modify Readme --- README.md | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 705dfbfc..83f076d8 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ Options: General: -q, --quality Optimization quality - [default: 75, Range: 1-100] + [range: 1 - 100] [default: 75] -f, --codec Image codec to use - [default: mozjpeg] + [default: mozjpeg] [possible values: png, oxipng, jpegxl, webp, avif] -o, --output Write output file(s) to -r, --recursive Saves output file(s) preserving folder structure -s, --suffix [] Appends suffix to output file(s) names @@ -53,17 +53,17 @@ General: Quantization: --quantization [] Enables quantization with optional quality - [default: 75, Range: 1-100] + [range: 1 - 100] [default: 75] --dithering [] Enables dithering with optional quality - [default: 75, Range: 1-100] + [range: 1 - 100] [default: 75] Resizing: --width Resize image with specified width - [Integer only] + [integer only] --height Resize image with specified height - [Integer only] + [integer only] --filter Filter used for image resizing - [default: lanczos3] + [default: lanczos3][possible values: point, triangle, catmull-rom, mitchell] ``` Note that image formats may wary from features that are used when building `rimage`. @@ -87,12 +87,34 @@ List of available resize filters: ## Example -|Image|Quality|Format|Dir|Backup| +### png => jpg & quality => 90 & backup + +|Image Path|Quality|Out Format|Out Dir|Backup| |----|----|----|----|----| |"D:\\Desktop\\input [text].png"|90|jpg|"D:\\Desktop\\OutputTest"|True| ```sh -rimage.exe "D:\\Desktop\\input [text].png" -q 90 --codec jpg -o "D:\\Desktop\\OutputTest" -b +rimage.exe "D:\\Desktop\\input [text].png" -q 90 -f jpg -o "D:\\Desktop\\OutputTest" -b +``` + +### suffix & recursive & quantization & dithering + +|Image Path|Quality|Out Format|Suffix|Recursive|Quantization|Dithering| +|----|----|----|----|----|----|----| +|"C:\\中 文\\ソフトウェア.PNG"|40|png|_문자|True|95|85| + +```sh +rimage.exe "C:\\中 文\\ソフトウェア.PNG" -q 40 --codec png -s "_문자" -r --quantization 95 --dithering 85 +``` + +### jpg => webp & resize width and height (both are opinional) + +|Image Path|Quality|Out Format|Out Dir|Width|Height| +|----|----|----|----|----|---| +|"C:\\Docs\\justfortest.JPG"|40|webp|"C:\\Desktop\\Test"|60|10| + +```sh +rimage.exe "C:\\Docs\\justfortest.PNG" --quality 40 --codec webp --output "C:\\Desktop\\Test" --width 60 --height 10 ``` ## Library Installation From 7dcc5778f10dc1d04e95a48ee9c577753aae6042 Mon Sep 17 00:00:00 2001 From: LinkChou Date: Tue, 10 Oct 2023 01:16:13 +0800 Subject: [PATCH 3/3] add a space --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83f076d8..c90c9c48 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Resizing: --height Resize image with specified height [integer only] --filter Filter used for image resizing - [default: lanczos3][possible values: point, triangle, catmull-rom, mitchell] + [default: lanczos3] [possible values: point, triangle, catmull-rom, mitchell] ``` Note that image formats may wary from features that are used when building `rimage`.