@unityclaw/skills 1.0.0
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/README.md +125 -0
- package/dist/chunk-KHQZYC3Y.js +163 -0
- package/dist/cli.cjs +237 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +69 -0
- package/dist/index.cjs +197 -0
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +18 -0
- package/package.json +59 -0
- package/unityclaw-document-convert/SKILL.md +375 -0
- package/unityclaw-document-translation/SKILL.md +273 -0
- package/unityclaw-image-compress/SKILL.md +229 -0
- package/unityclaw-image-generation/SKILL.md +213 -0
- package/unityclaw-media-analysis/SKILL.md +315 -0
- package/unityclaw-video-generation-kling/SKILL.md +233 -0
- package/unityclaw-video-generation-other/SKILL.md +284 -0
- package/unityclaw-video-generation-sora/SKILL.md +250 -0
- package/unityclaw-video-generation-veo/SKILL.md +239 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unityclaw-image-compress
|
|
3
|
+
description: Compress images with quality control to reduce file size
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
metadata:
|
|
6
|
+
openclaw:
|
|
7
|
+
requires:
|
|
8
|
+
env:
|
|
9
|
+
- UNITYCLAW_API_KEY
|
|
10
|
+
bins:
|
|
11
|
+
- node
|
|
12
|
+
- npm
|
|
13
|
+
primaryEnv: UNITYCLAW_API_KEY
|
|
14
|
+
emoji: "ποΈ"
|
|
15
|
+
homepage: https://unityclaw.com
|
|
16
|
+
install:
|
|
17
|
+
- kind: node
|
|
18
|
+
package: "@unityclaw/sdk"
|
|
19
|
+
bins: []
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# UnityClaw Image Compress
|
|
23
|
+
|
|
24
|
+
Compress images to reduce file size while maintaining visual quality.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @unityclaw/sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
Set your API key as environment variable:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export UNITYCLAW_API_KEY=your-api-key
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { UnityClawClient } from '@unityclaw/sdk';
|
|
44
|
+
|
|
45
|
+
const client = new UnityClawClient();
|
|
46
|
+
|
|
47
|
+
const result = await client.image.compress({
|
|
48
|
+
attachment: [
|
|
49
|
+
{ tmp_url: 'https://example.com/large-image.jpg', name: 'image.jpg' }
|
|
50
|
+
],
|
|
51
|
+
quality: 80
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (result.code === 0) {
|
|
55
|
+
console.log('Compressed images:', result.data);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## API Reference
|
|
60
|
+
|
|
61
|
+
### compress()
|
|
62
|
+
|
|
63
|
+
Compress one or more images with customizable quality.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
await client.image.compress({
|
|
67
|
+
attachment: AttachmentFieldItem[],
|
|
68
|
+
quality?: number
|
|
69
|
+
}): Promise<APIResponse<AttachmentResult[]>>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Parameters
|
|
73
|
+
|
|
74
|
+
| Parameter | Type | Required | Description |
|
|
75
|
+
|-----------|------|----------|-------------|
|
|
76
|
+
| `attachment` | `AttachmentFieldItem[]` | Yes | Array of images to compress |
|
|
77
|
+
| `quality` | `number` | No | Compression quality (0-100, default: 80) |
|
|
78
|
+
|
|
79
|
+
### AttachmentFieldItem
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
interface AttachmentFieldItem {
|
|
83
|
+
tmp_url: string; // URL of the image to compress
|
|
84
|
+
name?: string; // File name
|
|
85
|
+
type?: string; // MIME type (e.g., 'image/jpeg')
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
### Single Image Compression
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
const client = new UnityClawClient();
|
|
95
|
+
|
|
96
|
+
const result = await client.image.compress({
|
|
97
|
+
attachment: [
|
|
98
|
+
{ tmp_url: 'https://example.com/photo.jpg', name: 'photo.jpg', type: 'image/jpeg' }
|
|
99
|
+
],
|
|
100
|
+
quality: 75
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (result.code === 0 && result.data) {
|
|
104
|
+
const compressedImage = result.data[0];
|
|
105
|
+
console.log('Compressed URL:', compressedImage.content);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Batch Compression
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
const images = [
|
|
113
|
+
{ tmp_url: 'https://example.com/img1.jpg', name: 'img1.jpg' },
|
|
114
|
+
{ tmp_url: 'https://example.com/img2.png', name: 'img2.png' },
|
|
115
|
+
{ tmp_url: 'https://example.com/img3.webp', name: 'img3.webp' }
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
const result = await client.image.compress({
|
|
119
|
+
attachment: images,
|
|
120
|
+
quality: 80
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (result.code === 0 && result.data) {
|
|
124
|
+
result.data.forEach((img, i) => {
|
|
125
|
+
console.log(`Image ${i + 1}: ${img.content}`);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### High Quality Compression
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// Preserve more detail (larger file size)
|
|
134
|
+
const result = await client.image.compress({
|
|
135
|
+
attachment: [{ tmp_url: 'https://...', name: 'photo.jpg' }],
|
|
136
|
+
quality: 90
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Aggressive Compression
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// Smaller file size (more quality loss)
|
|
144
|
+
const result = await client.image.compress({
|
|
145
|
+
attachment: [{ tmp_url: 'https://...', name: 'photo.jpg' }],
|
|
146
|
+
quality: 50
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### With Generated Images
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Generate then compress
|
|
154
|
+
const generated = await client.image.gemini({
|
|
155
|
+
prompt: 'A beautiful landscape'
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
if (generated.code === 0 && generated.data) {
|
|
159
|
+
const compressed = await client.image.compress({
|
|
160
|
+
attachment: generated.data.map(img => ({
|
|
161
|
+
tmp_url: img.content,
|
|
162
|
+
name: img.name
|
|
163
|
+
})),
|
|
164
|
+
quality: 75
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
console.log('Compressed generated images:', compressed.data);
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Response Format
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
interface AttachmentResult {
|
|
175
|
+
name: string;
|
|
176
|
+
contentType: 'attachment/url';
|
|
177
|
+
content: string; // URL to compressed image
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Error Handling
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
const result = await client.image.compress({
|
|
185
|
+
attachment: [{ tmp_url: 'invalid-url', name: 'test.jpg' }],
|
|
186
|
+
quality: 80
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
if (result.code !== 0) {
|
|
190
|
+
console.error('Compression failed:', result.msg);
|
|
191
|
+
} else {
|
|
192
|
+
console.log('Success:', result.data);
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Quality Guidelines
|
|
197
|
+
|
|
198
|
+
| Quality | Use Case | File Size Reduction |
|
|
199
|
+
|---------|----------|---------------------|
|
|
200
|
+
| 90-100 | Print, professional photography | Minimal |
|
|
201
|
+
| 75-89 | Web display, social media | Moderate |
|
|
202
|
+
| 50-74 | Thumbnails, previews | Significant |
|
|
203
|
+
| 0-49 | Aggressive optimization | Maximum |
|
|
204
|
+
|
|
205
|
+
## Supported Formats
|
|
206
|
+
|
|
207
|
+
- JPEG/JPG
|
|
208
|
+
- PNG
|
|
209
|
+
- WebP
|
|
210
|
+
- GIF (static)
|
|
211
|
+
|
|
212
|
+
## Task Folders
|
|
213
|
+
|
|
214
|
+
Each execution creates a task folder with logs and downloaded attachments:
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
const result = await client.image.compress({
|
|
218
|
+
attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }],
|
|
219
|
+
quality: 80
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
console.log('Task ID:', result.taskId);
|
|
223
|
+
console.log('Task Folder:', result.taskFolder);
|
|
224
|
+
console.log('Local Attachments:', result.attachments);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Related Skills
|
|
228
|
+
|
|
229
|
+
- [unityclaw-image-generation](../unityclaw-image-generation/SKILL.md) - Generate images before compression
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unityclaw-image-generation
|
|
3
|
+
description: Generate high-quality images using Gemini or JiMeng (Doubao) models
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
metadata:
|
|
6
|
+
openclaw:
|
|
7
|
+
requires:
|
|
8
|
+
env:
|
|
9
|
+
- UNITYCLAW_API_KEY
|
|
10
|
+
bins:
|
|
11
|
+
- node
|
|
12
|
+
- npm
|
|
13
|
+
primaryEnv: UNITYCLAW_API_KEY
|
|
14
|
+
emoji: "π¨"
|
|
15
|
+
homepage: https://unityclaw.com
|
|
16
|
+
install:
|
|
17
|
+
- kind: node
|
|
18
|
+
package: "@unityclaw/sdk"
|
|
19
|
+
bins: []
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# UnityClaw Image Generation
|
|
23
|
+
|
|
24
|
+
Generate high-quality images using Gemini or JiMeng (Doubao) AI models.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @unityclaw/sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
Set your API key as environment variable:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export UNITYCLAW_API_KEY=your-api-key
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { UnityClawClient } from '@unityclaw/sdk';
|
|
44
|
+
|
|
45
|
+
const client = new UnityClawClient();
|
|
46
|
+
|
|
47
|
+
// Generate image with Gemini
|
|
48
|
+
const result = await client.image.gemini({
|
|
49
|
+
prompt: 'A beautiful sunset over mountains',
|
|
50
|
+
aspect_ratio: { value: '16:9', label: '16:9' }
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (result.code === 0) {
|
|
54
|
+
console.log('Generated images:', result.data);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Available APIs
|
|
59
|
+
|
|
60
|
+
### Gemini Image Generation
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// Basic usage
|
|
64
|
+
const result = await client.image.gemini({
|
|
65
|
+
prompt: 'A beautiful sunset over mountains'
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// With all options
|
|
69
|
+
const result = await client.image.gemini({
|
|
70
|
+
prompt: 'A futuristic city at night',
|
|
71
|
+
attachment: [{ tmp_url: 'https://...', name: 'reference.jpg' }],
|
|
72
|
+
model: { value: 'gemini-2.0-flash-exp', label: 'Gemini 2.0 Flash' },
|
|
73
|
+
aspect_ratio: { value: '16:9', label: '16:9' },
|
|
74
|
+
size: { value: '2K', label: '2K' }
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Gemini V2
|
|
78
|
+
const result = await client.image.geminiV2({
|
|
79
|
+
prompt: 'An abstract digital art piece',
|
|
80
|
+
aspect_ratio: { value: '1:1', label: '1:1' }
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### JiMeng Image Generation
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
// Basic usage
|
|
88
|
+
const result = await client.image.jimeng({
|
|
89
|
+
prompt: 'δΈεͺε―η±ηη«εͺε¨θ±ειη©θ',
|
|
90
|
+
size: { value: '1024x1024', label: '1:1' }
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// With all options
|
|
94
|
+
const result = await client.image.jimeng({
|
|
95
|
+
prompt: 'A serene Japanese garden in autumn',
|
|
96
|
+
attachment: [{ tmp_url: 'https://...', name: 'style.jpg' }],
|
|
97
|
+
size: { value: '1024x1024', label: '1:1' },
|
|
98
|
+
model_selector: { value: 'general', label: 'General' },
|
|
99
|
+
web_search: { value: true, label: 'Enable' },
|
|
100
|
+
image_count: { value: 4, label: '4 images' }
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// JiMeng V3
|
|
104
|
+
const result = await client.image.jimengV3({
|
|
105
|
+
prompt: 'A mystical forest with glowing mushrooms',
|
|
106
|
+
size: { value: '1024x1024', label: '1:1' }
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Parameter Types
|
|
111
|
+
|
|
112
|
+
### GeminiImageParams
|
|
113
|
+
|
|
114
|
+
| Parameter | Type | Required | Description |
|
|
115
|
+
|-----------|------|----------|-------------|
|
|
116
|
+
| `prompt` | `string \| TextFieldItem[]` | Yes | Text description of the image |
|
|
117
|
+
| `attachment` | `AttachmentFieldItem[]` | No | Reference images for style transfer |
|
|
118
|
+
| `model` | `LabelFieldItem` | No | Model selection (default: gemini-2.0-flash-exp) |
|
|
119
|
+
| `aspect_ratio` | `LabelFieldItem` | No | Aspect ratio: `'1:1'`, `'9:16'`, `'16:9'` |
|
|
120
|
+
| `size` | `LabelFieldItem` | No | Resolution: `'1K'`, `'2K'`, `'4K'` |
|
|
121
|
+
|
|
122
|
+
### JiMengImageParams
|
|
123
|
+
|
|
124
|
+
| Parameter | Type | Required | Description |
|
|
125
|
+
|-----------|------|----------|-------------|
|
|
126
|
+
| `prompt` | `string \| TextFieldItem[]` | Yes | Text description (supports Chinese) |
|
|
127
|
+
| `attachment` | `AttachmentFieldItem[]` | No | Reference images |
|
|
128
|
+
| `size` | `LabelFieldItem` | Yes | Size: `'1024x1024'` (1:1), `'896x1152'` (9:16), `'1152x896'` (16:9) |
|
|
129
|
+
| `model_selector` | `LabelFieldItem` | No | Model type |
|
|
130
|
+
| `web_search` | `LabelFieldItem` | No | Enable web search for references |
|
|
131
|
+
| `image_count` | `LabelFieldItem \| number` | No | Number of images to generate |
|
|
132
|
+
|
|
133
|
+
## Examples
|
|
134
|
+
|
|
135
|
+
### Text-to-Image
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const client = new UnityClawClient();
|
|
139
|
+
|
|
140
|
+
const result = await client.image.gemini({
|
|
141
|
+
prompt: 'A cyberpunk cityscape with neon lights reflecting on wet streets',
|
|
142
|
+
aspect_ratio: { value: '16:9', label: '16:9' },
|
|
143
|
+
size: { value: '2K', label: '2K' }
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (result.code === 0 && result.data) {
|
|
147
|
+
result.data.forEach((img, i) => {
|
|
148
|
+
console.log(`Image ${i + 1}: ${img.content}`);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Image-to-Image (Style Transfer)
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const result = await client.image.gemini({
|
|
157
|
+
prompt: 'Transform this photo into a watercolor painting style',
|
|
158
|
+
attachment: [
|
|
159
|
+
{ tmp_url: 'https://example.com/photo.jpg', name: 'photo.jpg' }
|
|
160
|
+
],
|
|
161
|
+
aspect_ratio: { value: '1:1', label: '1:1' }
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Batch Generation
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
const prompts = [
|
|
169
|
+
'A serene mountain lake at dawn',
|
|
170
|
+
'A bustling Tokyo street at night',
|
|
171
|
+
'An underwater coral reef scene'
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
const results = await Promise.all(
|
|
175
|
+
prompts.map(prompt => client.image.gemini({ prompt }))
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
results.forEach((result, i) => {
|
|
179
|
+
if (result.code === 0) {
|
|
180
|
+
console.log(`Prompt ${i + 1}: Success`);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Error Handling
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const result = await client.image.gemini({ prompt: 'test' });
|
|
189
|
+
|
|
190
|
+
if (result.code !== 0) {
|
|
191
|
+
console.error('Error:', result.msg);
|
|
192
|
+
// Handle error
|
|
193
|
+
} else {
|
|
194
|
+
console.log('Success:', result.data);
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Task Folders
|
|
199
|
+
|
|
200
|
+
Each execution creates a task folder:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
const result = await client.image.gemini({ prompt: 'test' });
|
|
204
|
+
|
|
205
|
+
console.log('Task ID:', result.taskId);
|
|
206
|
+
console.log('Task Folder:', result.taskFolder);
|
|
207
|
+
console.log('Attachments:', result.attachments);
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Related Skills
|
|
211
|
+
|
|
212
|
+
- [unityclaw-image-compress](../unityclaw-image-compress/SKILL.md) - Compress generated images
|
|
213
|
+
- [unityclaw-video-generation-sora](../unityclaw-video-generation-sora/SKILL.md) - Generate videos with Sora
|