qasai 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/image.png +0 -0
- package/AGENTS.md +15 -0
- package/README.md +8 -3
- package/docs/spec.md +114 -0
- package/package.json +1 -1
|
Binary file
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Memory
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
See @README.md for project overview and @package.json for available npm/pnpm commands for this project.
|
|
5
|
+
|
|
6
|
+
## Code Style Guidelines
|
|
7
|
+
- Use descriptive variable names
|
|
8
|
+
- Follow existing patterns in the codebase
|
|
9
|
+
- Extract complex conditions into meaningful boolean variables
|
|
10
|
+
|
|
11
|
+
## Architecture Notes
|
|
12
|
+
Add important architectural decisions and patterns here.
|
|
13
|
+
|
|
14
|
+
## Common Workflows
|
|
15
|
+
Document frequently used workflows and commands here.
|
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# QASAI
|
|
2
4
|
|
|
3
5
|
A powerful image compression CLI with multiple engine support, lossless/lossy options, and both interactive and non-interactive modes.
|
|
4
6
|
|
|
7
|
+
📖 **[Full Specification](./docs/spec.md)**
|
|
8
|
+
|
|
5
9
|
## Features
|
|
6
10
|
|
|
7
11
|
- **Multiple compression engines** - Choose the best tool for each format
|
|
@@ -14,8 +18,9 @@ A powerful image compression CLI with multiple engine support, lossless/lossy op
|
|
|
14
18
|
## Installation
|
|
15
19
|
|
|
16
20
|
```bash
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
npm install -g qasai
|
|
22
|
+
# or
|
|
23
|
+
npx qasai
|
|
19
24
|
```
|
|
20
25
|
|
|
21
26
|
## Usage
|
|
@@ -287,4 +292,4 @@ qasai compress ./images -f avif -q 70
|
|
|
287
292
|
|
|
288
293
|
## License
|
|
289
294
|
|
|
290
|
-
|
|
295
|
+
Apache 2.0 by [Ahmad Awais](https://x.com/MrAhmadAwais)
|
package/docs/spec.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# QASAI Specification
|
|
2
|
+
|
|
3
|
+
Image compression CLI with lossless and lossy options.
|
|
4
|
+
|
|
5
|
+
## Supported Formats
|
|
6
|
+
|
|
7
|
+
- JPEG (.jpg, .jpeg)
|
|
8
|
+
- PNG (.png)
|
|
9
|
+
- WebP (.webp)
|
|
10
|
+
- AVIF (.avif)
|
|
11
|
+
- GIF (.gif)
|
|
12
|
+
- TIFF (.tiff)
|
|
13
|
+
- SVG (.svg)
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
### `qasai` (default)
|
|
18
|
+
|
|
19
|
+
Runs interactive mode with guided prompts.
|
|
20
|
+
|
|
21
|
+
### `qasai compress [input]`
|
|
22
|
+
|
|
23
|
+
Compress images in a directory or file.
|
|
24
|
+
|
|
25
|
+
**Arguments:**
|
|
26
|
+
- `input` - Input directory or file (default: `.`)
|
|
27
|
+
|
|
28
|
+
**Options:**
|
|
29
|
+
|
|
30
|
+
| Option | Description | Default |
|
|
31
|
+
|--------|-------------|---------|
|
|
32
|
+
| `-o, --output <dir>` | Output directory | `Kasai/` in input dir |
|
|
33
|
+
| `-i, --in-place` | Overwrite originals | `false` |
|
|
34
|
+
| `-q, --quality <n>` | Quality 1-100 | `80` |
|
|
35
|
+
| `-l, --lossless` | Lossless compression | `false` |
|
|
36
|
+
| `--resize <dim>` | Resize (e.g., `800x600`, `50%`) | - |
|
|
37
|
+
| `--max-width <px>` | Max width (keeps aspect ratio) | - |
|
|
38
|
+
| `--max-height <px>` | Max height (keeps aspect ratio) | - |
|
|
39
|
+
| `-f, --format <fmt>` | Convert to format | - |
|
|
40
|
+
| `-r, --recursive` | Process subdirectories | `false` |
|
|
41
|
+
| `--keep-metadata` | Preserve EXIF data | `false` |
|
|
42
|
+
| `--no-progressive` | Disable progressive JPEGs | `false` |
|
|
43
|
+
| `--effort <n>` | Compression effort 1-10 | `6` |
|
|
44
|
+
| `--jpeg-engine <e>` | JPEG engine | `mozjpeg` |
|
|
45
|
+
| `--png-engine <e>` | PNG engine | `pngquant` |
|
|
46
|
+
| `--gif-engine <e>` | GIF engine | `gifsicle` |
|
|
47
|
+
| `--png-quality <r>` | PNG quality range | `65-80` |
|
|
48
|
+
| `--colors <n>` | Max colors for PNG/GIF | `256` |
|
|
49
|
+
|
|
50
|
+
## Compression Engines
|
|
51
|
+
|
|
52
|
+
### JPEG
|
|
53
|
+
|
|
54
|
+
| Engine | Type | Description |
|
|
55
|
+
|--------|------|-------------|
|
|
56
|
+
| `mozjpeg` | Lossy | Best compression, slower |
|
|
57
|
+
| `jpegtran` | Lossless | Optimize without quality loss |
|
|
58
|
+
| `sharp` | Lossy | Fast, good compression |
|
|
59
|
+
|
|
60
|
+
### PNG
|
|
61
|
+
|
|
62
|
+
| Engine | Type | Description |
|
|
63
|
+
|--------|------|-------------|
|
|
64
|
+
| `pngquant` | Lossy | Best compression, quantization |
|
|
65
|
+
| `optipng` | Lossless | Optimize without quality loss |
|
|
66
|
+
| `sharp` | Both | Fast, palette-based |
|
|
67
|
+
|
|
68
|
+
### GIF
|
|
69
|
+
|
|
70
|
+
| Engine | Type | Description |
|
|
71
|
+
|--------|------|-------------|
|
|
72
|
+
| `gifsicle` | Both | Best for animated GIFs |
|
|
73
|
+
| `sharp` | Lossy | Fast, basic optimization |
|
|
74
|
+
|
|
75
|
+
### SVG
|
|
76
|
+
|
|
77
|
+
Uses SVGO with multipass optimization.
|
|
78
|
+
|
|
79
|
+
### WebP/AVIF/TIFF
|
|
80
|
+
|
|
81
|
+
Uses Sharp for all operations.
|
|
82
|
+
|
|
83
|
+
## Output
|
|
84
|
+
|
|
85
|
+
Compression results show:
|
|
86
|
+
- Original size
|
|
87
|
+
- Compressed size
|
|
88
|
+
- Bytes saved
|
|
89
|
+
- Percentage saved
|
|
90
|
+
|
|
91
|
+
## Examples
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Interactive mode
|
|
95
|
+
qasai
|
|
96
|
+
|
|
97
|
+
# Compress current directory
|
|
98
|
+
qasai compress
|
|
99
|
+
|
|
100
|
+
# Compress with quality 60
|
|
101
|
+
qasai compress ./images -q 60
|
|
102
|
+
|
|
103
|
+
# Lossless compression
|
|
104
|
+
qasai compress ./images -l
|
|
105
|
+
|
|
106
|
+
# Convert to WebP
|
|
107
|
+
qasai compress ./images -f webp
|
|
108
|
+
|
|
109
|
+
# Resize and compress
|
|
110
|
+
qasai compress ./images --max-width 1920 -q 75
|
|
111
|
+
|
|
112
|
+
# In-place compression
|
|
113
|
+
qasai compress ./images -i
|
|
114
|
+
```
|