You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# recursively create AVIF and WebP versions for images in a directory
52
+
# recursively create AVIF and WebP versions for all images in a directory
55
53
optimizt --avif --webp path/to/directory
56
54
57
55
# recursively optimize JPEG files in the current directory
58
56
find . -iname \*.jpg -exec optimizt {} +
59
57
```
60
58
61
-
## Differences between Lossy and Lossless
62
-
63
-
### Lossy (default)
59
+
## Differences Between Lossy and Lossless
64
60
65
-
Gives the best balance between compression and minimal visual changes.
61
+
### Lossy (Default)
66
62
67
-
### Lossless (with `--lossless` flag)
63
+
Provides the best balance between file size reduction and minimal visual quality loss.
68
64
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)
70
66
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.
72
70
73
71
## Configuration
74
72
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:
76
74
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.
78
78
79
79
> [!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.
85
81
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`.
87
83
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.
89
85
90
86
## Troubleshooting
91
87
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”.
95
89
90
+
Ensure the [ignore-scripts](https://docs.npmjs.com/cli/v6/using-npm/config#ignore-scripts) npm option is disabled.
0 commit comments