Skip to content

Commit 41cb5c1

Browse files
authored
Merge pull request #28 from 343dev/imporvement/docs
Update README
2 parents c4c1420 + 8719e4f commit 41cb5c1

File tree

3 files changed

+44
-216
lines changed

3 files changed

+44
-216
lines changed

README.md

Lines changed: 42 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +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.
12-
13-
[По-русски](./README.ru.md)
11+
It can compress PNG, JPEG, GIF, and SVG lossy or lossless, and create AVIF and WebP versions for raster images.
1412

1513
## Rationale
1614

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

2321
```sh
24-
npm i -g @343dev/optimizt
22+
npm install -g @343dev/optimizt
2523
```
2624

2725
Optimize!
@@ -30,123 +28,110 @@ Optimize!
3028
optimizt path/to/picture.jpg
3129
```
3230

33-
## Command line flags
31+
## Command Line Flags
3432

3533
- `--avif` — create AVIF versions of images.
3634
- `--webp` — create WebP versions of images.
37-
- `-f, --force` — recreate AVIF and WebP versions if the file already exists.
35+
- `-f, --force` — recreate AVIF and WebP versions even if they already exist.
3836
- `-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.
37+
- `-v, --verbose` — show detailed output (e.g. skipped files).
38+
- `-c, --config` — use a custom configuration file instead of the default.
39+
- `-o, --output` — write results to the specified directory.
40+
- `-V, --version`display the tool version.
41+
- `-h, --help` — show help message.
4442

4543
## Usage Examples
4644

4745
```bash
48-
# optimize one image
46+
# optimize a single image
4947
optimizt path/to/picture.jpg
5048

51-
# optimize several images losslessly
49+
# optimize multiple images losslessly
5250
optimizt --lossless path/to/picture.jpg path/to/another/picture.png
5351

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

5755
# recursively optimize JPEG files in the current directory
5856
find . -iname \*.jpg -exec optimizt {} +
5957
```
6058

61-
## Differences between Lossy and Lossless
62-
63-
### Lossy (default)
59+
## Differences Between Lossy and Lossless
6460

65-
Gives the best balance between compression and minimal visual changes.
61+
### Lossy (Default)
6662

67-
### Lossless (with `--lossless` flag)
63+
Provides the best balance between file size reduction and minimal visual quality loss.
6864

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.
65+
### Lossless (`--lossless` flag)
7066

71-
For SVG files, the settings in Lossy and Lossless modes are identical.
67+
- **AVIF/WebP**: Uses lossless compression.
68+
- **PNG/JPEG/GIF**: Maximizes image quality at the expense of larger file sizes.
69+
- **SVG**: Settings are identical in both modes.
7270

7371
## Configuration
7472

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).
73+
Image processing leverages:
7674

77-
SVG is processed by [svgo](https://github.com/svg/svgo), while for GIF, [gifsicle](https://github.com/kohler/gifsicle) is used.
75+
- [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).
76+
- [svgo](https://github.com/svg/svgo) for SVG.
77+
- [gifsicle](https://github.com/kohler/gifsicle) for GIF.
7878

7979
> [!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`.
80+
> In Lossless mode for JPEG, [Guetzli](https://github.com/google/guetzli) is used. Repeated optimization may degrade visual quality.
8581
86-
When running with the `--config path/to/.optimiztrc.cjs` flag, the settings from the specified configuration file will be used for image processing.
82+
Default settings are defined in [.optimiztrc.cjs](./.optimiztrc.cjs), which includes all supported parameters. Disable any parameter by setting it to `false`.
8783

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.
84+
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.
8985

9086
## Troubleshooting
9187

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.
88+
### Errors like “spawn guetzli ENOENT”.
9589

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

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-
10893
## Docker
10994

110-
### Using a pre-built image
95+
### Pre-Built Image
11196

11297
```bash
113-
# pull by name
98+
# pull latest
11499
docker pull 343dev/optimizt
115100

116-
# pull by name and version
101+
# pull specific version
117102
docker pull 343dev/optimizt:9.0.2
118103
```
119104

120-
### Build the image manually
105+
### Manual Build
121106

122107
```bash
123-
# clone the Optimizt repository
108+
# clone repository
124109
git clone https://github.com/343dev/optimizt.git
125-
126-
# go to the repository folder
127110
cd optimizt
128111

129-
# build the image
112+
# build image
130113
docker build --tag 343dev/optimizt .
131114
```
132115

133-
OR:
116+
Alternatively:
134117

135118
```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
119+
# build directly from GitHub
120+
# ignores .dockerignore (see: https://github.com/docker/cli/issues/2827)
138121
docker build --tag 343dev/optimizt https://github.com/343dev/optimizt.git
139122
```
140123

141-
### Running the container
124+
### Run Container
142125

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

148131
## Integrations
149132

133+
Optimizt works seamlessly with:
134+
150135
- [JetBrains IDEs](./docs/jetbrains.md)
151136
- [Visual Studio Code](./docs/vscode.md)
152137
- [Sublime Text 3](./docs/sublime-text.md)

README.ru.md

Lines changed: 0 additions & 157 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
"author": "Andrey Warkentin (https://github.com/343dev)",
2020
"repository": {
2121
"type": "git",
22-
"url": "https://github.com/343dev/optimizt"
22+
"url": "git+https://github.com/343dev/optimizt.git"
2323
},
2424
"exports": "./index.js",
2525
"bin": {
26-
"optimizt": "./cli.js"
26+
"optimizt": "cli.js"
2727
},
2828
"files": [
2929
"MIGRATION.md",

0 commit comments

Comments
 (0)