Skip to content

Commit ae62405

Browse files
committed
Update README
1 parent c4c1420 commit ae62405

File tree

1 file changed

+42
-55
lines changed

1 file changed

+42
-55
lines changed

README.md

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# @343dev/optimizt
22

33
<img align="right" width="192" height="192"
4-
alt="Optimizt avatar: OK sign with Mona Lisa picture between the fingers"
4+
alt="Optimizt logo: OK hand sign with Mona Lisa image between the fingers"
55
src="./docs/logo.png">
66

77
[![npm](https://img.shields.io/npm/v/@343dev/optimizt.svg)](https://www.npmjs.com/package/@343dev/optimizt)
88

99
**Optimizt** is a command-line tool that helps prepare images for the web.
1010

11-
It can compress PNG, JPEG, GIF and SVG lossy and lossless, and also create AVIF and WebP versions for raster images.
11+
It can compress PNG, JPEG, GIF, and SVG lossy or lossless, and create AVIF and WebP versions for raster images.
1212

1313
[По-русски](./README.ru.md)
1414

@@ -21,7 +21,7 @@ As frontend developers, we have to care about pictures: compress PNG and JPEG, r
2121
Install:
2222

2323
```sh
24-
npm i -g @343dev/optimizt
24+
npm install -g @343dev/optimizt
2525
```
2626

2727
Optimize!
@@ -30,123 +30,110 @@ Optimize!
3030
optimizt path/to/picture.jpg
3131
```
3232

33-
## Command line flags
33+
## Command Line Flags
3434

3535
- `--avif` — create AVIF versions of images.
3636
- `--webp` — create WebP versions of images.
37-
- `-f, --force` — recreate AVIF and WebP versions if the file already exists.
37+
- `-f, --force` — recreate AVIF and WebP versions even if they already exist.
3838
- `-l, --lossless` — optimize losslessly instead of lossily.
39-
- `-v, --verbose` — show more details during the process (e.g. skipped files).
40-
- `-c, --config` — use a provided configuration file instead of the default one.
41-
- `-o, --output` — write result to provided directory.
42-
- `-V, --version`show the tool version.
43-
- `-h, --help` — show help.
39+
- `-v, --verbose` — show detailed output (e.g. skipped files).
40+
- `-c, --config` — use a custom configuration file instead of the default.
41+
- `-o, --output` — write results to the specified directory.
42+
- `-V, --version`display the tool version.
43+
- `-h, --help` — show help message.
4444

4545
## Usage Examples
4646

4747
```bash
48-
# optimize one image
48+
# optimize a single image
4949
optimizt path/to/picture.jpg
5050

51-
# optimize several images losslessly
51+
# optimize multiple images losslessly
5252
optimizt --lossless path/to/picture.jpg path/to/another/picture.png
5353

54-
# recursively create AVIF and WebP versions for images in a directory
54+
# recursively create AVIF and WebP versions for all images in a directory
5555
optimizt --avif --webp path/to/directory
5656

5757
# recursively optimize JPEG files in the current directory
5858
find . -iname \*.jpg -exec optimizt {} +
5959
```
6060

61-
## Differences between Lossy and Lossless
61+
## Differences Between Lossy and Lossless
6262

63-
### Lossy (default)
63+
### Lossy (Default)
6464

65-
Gives the best balance between compression and minimal visual changes.
65+
Provides the best balance between file size reduction and minimal visual quality loss.
6666

67-
### Lossless (with `--lossless` flag)
67+
### Lossless (`--lossless` flag)
6868

69-
When creating AVIF and WebP, it uses lossless compression. For PNG, JPEG, and GIF optimization, it maximizes image quality at the cost of larger file size.
70-
71-
For SVG files, the settings in Lossy and Lossless modes are identical.
69+
- **AVIF/WebP**: Uses lossless compression.
70+
- **PNG/JPEG/GIF**: Maximizes image quality at the expense of larger file sizes.
71+
- **SVG**: Settings are identical in both modes.
7272

7373
## Configuration
7474

75-
Image processing is done using [sharp](https://github.com/lovell/sharp) for [JPEG](https://sharp.pixelplumbing.com/api-output#jpeg), [PNG](https://sharp.pixelplumbing.com/api-output#png), [WebP](https://sharp.pixelplumbing.com/api-output#webp), and [AVIF](https://sharp.pixelplumbing.com/api-output#avif).
75+
Image processing leverages:
7676

77-
SVG is processed by [svgo](https://github.com/svg/svgo), while for GIF, [gifsicle](https://github.com/kohler/gifsicle) is used.
77+
- [sharp](https://github.com/lovell/sharp) for [JPEG](https://sharp.pixelplumbing.com/api-output#jpeg), [PNG](https://sharp.pixelplumbing.com/api-output#png), [WebP](https://sharp.pixelplumbing.com/api-output#webp), and [AVIF](https://sharp.pixelplumbing.com/api-output#avif).
78+
- [svgo](https://github.com/svg/svgo) for SVG.
79+
- [gifsicle](https://github.com/kohler/gifsicle) for GIF.
7880

7981
> [!NOTE]
80-
> In Lossless mode for JPEG, we use [Guetzli](https://github.com/google/guetzli), which offers high level of compression with good visual quality. However, repeated optimization may degrade visual quality.
81-
82-
The default settings are located in [.optimiztrc.cjs](./.optimiztrc.cjs), and the file contains a list of supported parameters and their brief description.
83-
84-
To disable any parameter, use the value `false`.
82+
> In Lossless mode for JPEG, [Guetzli](https://github.com/google/guetzli) is used. Repeated optimization may degrade visual quality.
8583
86-
When running with the `--config path/to/.optimiztrc.cjs` flag, the settings from the specified configuration file will be used for image processing.
84+
Default settings are defined in [.optimiztrc.cjs](./.optimiztrc.cjs), which includes all supported parameters. Disable any parameter by setting it to `false`.
8785

88-
If no `--config` flag is provided, a recursive search for the `.optimiztrc.cjs` file will be performed, starting from the current directory up to the root of the file system. If the file is not found, the default settings will be applied.
86+
When using `--config path/to/.optimiztrc.cjs`, the specified configuration file will be used. If no `--config` is provided, Optimizt searches recursively from the current directory upward for `.optimiztrc.cjs`. If none is found, defaults are applied.
8987

9088
## Troubleshooting
9189

92-
### “spawn guetzli ENOENT”, etc.
93-
94-
Make sure that the [ignore-scripts](https://docs.npmjs.com/cli/v6/using-npm/config#ignore-scripts) option is not enabled.
90+
### Errors like “spawn guetzli ENOENT”.
9591

92+
Ensure the [ignore-scripts](https://docs.npmjs.com/cli/v6/using-npm/config#ignore-scripts) npm option is disabled.
9693
Details: [funbox/optimizt/issues/9](https://github.com/funbox/optimizt/issues/9).
9794

98-
### “pkg-config: command not found”, “fatal error: 'png.h' file not found”, etc.
99-
100-
Some OS may lack necessary libraries. Install them manually.
101-
102-
Example for macOS using [Homebrew](https://brew.sh):
103-
104-
```bash
105-
brew install pkg-config libpng
106-
```
107-
10895
## Docker
10996

110-
### Using a pre-built image
97+
### Pre-Built Image
11198

11299
```bash
113-
# pull by name
100+
# pull latest
114101
docker pull 343dev/optimizt
115102

116-
# pull by name and version
103+
# pull specific version
117104
docker pull 343dev/optimizt:9.0.2
118105
```
119106

120-
### Build the image manually
107+
### Manual Build
121108

122109
```bash
123-
# clone the Optimizt repository
110+
# clone repository
124111
git clone https://github.com/343dev/optimizt.git
125-
126-
# go to the repository folder
127112
cd optimizt
128113

129-
# build the image
114+
# build image
130115
docker build --tag 343dev/optimizt .
131116
```
132117

133-
OR:
118+
Alternatively:
134119

135120
```bash
136-
# build the image without cloning the repository
137-
# in this case “.dockerignore” file will be ignored; see: https://github.com/docker/cli/issues/2827
121+
# build directly from GitHub
122+
# ignores .dockerignore (see: https://github.com/docker/cli/issues/2827)
138123
docker build --tag 343dev/optimizt https://github.com/343dev/optimizt.git
139124
```
140125

141-
### Running the container
126+
### Run Container
142127

143128
```bash
144-
# inside the container, WORKDIR is set to `/src`, so all paths will resolve from there
129+
# mount current directory to /src in the container
145130
docker run --rm --volume $(pwd):/src 343dev/optimizt --webp ./image.png
146131
```
147132

148133
## Integrations
149134

135+
Optimizt works seamlessly with:
136+
150137
- [JetBrains IDEs](./docs/jetbrains.md)
151138
- [Visual Studio Code](./docs/vscode.md)
152139
- [Sublime Text 3](./docs/sublime-text.md)

0 commit comments

Comments
 (0)