opencode-image-compressor 0.1.0 → 2026.4.9
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/LICENSE +21 -0
- package/README.md +30 -6
- package/package.json +6 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KristjanPikhof
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
`opencode-image-compressor` shrinks large image attachments into smaller JPEG payloads before they are passed into the model.
|
|
4
4
|
|
|
5
|
+
## Why this plugin exists
|
|
6
|
+
|
|
7
|
+
Sending image attachments in OpenCode could sometimes trigger session
|
|
8
|
+
compaction before the model had a chance to retain the actual visual
|
|
9
|
+
context. When that happened, the conversation summary might only keep a
|
|
10
|
+
reference to the uploaded image name, which made it difficult to
|
|
11
|
+
continue the session from where it left off.
|
|
12
|
+
|
|
13
|
+
Re-sending the same image after compaction could trigger compaction
|
|
14
|
+
again, so the issue would repeat instead of resolving itself.
|
|
15
|
+
|
|
16
|
+
This plugin works around that by aggressively compressing images before
|
|
17
|
+
they are sent to the model. It reduces image size by downscaling and
|
|
18
|
+
lowering visual quality while still preserving enough detail for the AI
|
|
19
|
+
to efficiently and successfully process image.
|
|
20
|
+
|
|
21
|
+
Because the model receives a much smaller image, it may also process the
|
|
22
|
+
attachment faster than a full-size original with far more pixels than it
|
|
23
|
+
actually needs saving tokens.
|
|
24
|
+
|
|
25
|
+
It is especially useful for screenshot-heavy workflows and tools that
|
|
26
|
+
send images into the session.
|
|
27
|
+
|
|
5
28
|
## What it does
|
|
6
29
|
|
|
7
30
|
- checks supported images larger than `200 KB`
|
|
@@ -9,7 +32,6 @@
|
|
|
9
32
|
- aims for roughly `50 KB`
|
|
10
33
|
- accepts results up to `200 KB`
|
|
11
34
|
- supports `image/jpeg`, `image/jpg`, `image/pjpeg`, `image/png`, and `image/webp`
|
|
12
|
-
- does not process GIF input
|
|
13
35
|
- keeps the original file when recompression fails or would not reduce size
|
|
14
36
|
|
|
15
37
|
## Installation
|
|
@@ -21,11 +43,7 @@ Requirements:
|
|
|
21
43
|
|
|
22
44
|
This plugin is intended to work on macOS, Linux and Windows as long as `sharp` installs and loads correctly on that machine.
|
|
23
45
|
|
|
24
|
-
|
|
25
|
-
bun add opencode-image-compressor
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Then add it to `opencode.json`:
|
|
46
|
+
In OpenCode setup, adding it to `opencode.json` is enough:
|
|
29
47
|
|
|
30
48
|
```json
|
|
31
49
|
{
|
|
@@ -33,6 +51,12 @@ Then add it to `opencode.json`:
|
|
|
33
51
|
}
|
|
34
52
|
```
|
|
35
53
|
|
|
54
|
+
If your environment does not auto-resolve npm plugins, install it first:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
bun add opencode-image-compressor
|
|
58
|
+
```
|
|
59
|
+
|
|
36
60
|
If installing from source:
|
|
37
61
|
|
|
38
62
|
```bash
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-image-compressor",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "OpenCode plugin that
|
|
3
|
+
"version": "2026.04.09",
|
|
4
|
+
"description": "An OpenCode plugin that reduces large attached images into AI-optimized JPEG payloads before they are sent to agent to conserve tokens and avoid conversation compaction.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
"image",
|
|
17
17
|
"jpeg",
|
|
18
18
|
"compression",
|
|
19
|
+
"compact",
|
|
20
|
+
"resize",
|
|
19
21
|
"attachments",
|
|
20
|
-
"images"
|
|
22
|
+
"images",
|
|
23
|
+
"image"
|
|
21
24
|
],
|
|
22
25
|
"license": "MIT",
|
|
23
26
|
"dependencies": {
|