@harpiaresearch/vref 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +237 -197
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,220 +1,251 @@
1
+ <div align="center">
2
+
1
3
  # VREF — Visual Reference Format
2
4
 
3
- > **Standardized container for curated visual references in AI image generation**
5
+ **A standardized format for curated visual references in AI image generation**
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/@harpiaresearch/vref)](https://www.npmjs.com/package/@harpiaresearch/vref)
6
8
  [![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE)
7
9
 
8
- Developed by [Harpia AI Research](https://harpiaresearch.cc) 🇧🇷
10
+ Harpia AI Research
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ <div align="center">
17
+
18
+ ## The Problem
19
+
20
+ </div>
21
+
22
+ You know exactly what you want your AI to generate, but describing it in words is **nearly impossible**.
23
+
24
+ - 🤔 "How do I describe this art style?"
25
+ - 📸 "I have 20 reference images, but uploading them one by one is tedious"
26
+ - 🔄 "I can't easily share or reuse my reference collections"
27
+ - 😤 "Text prompts alone just don't capture the vision"
28
+
29
+ **Visual concepts are hard to describe, but easy to show.**
30
+
31
+ ---
32
+
33
+ <div align="center">
34
+
35
+ ## The Solution
36
+
37
+ **VREF** (Visual Reference Format) is a simple, open standard that packages your visual references into a single `.vref` file.
38
+
39
+ ```
40
+ Your 50 reference images → one references.vref file
41
+ ```
42
+
43
+ </div>
44
+
45
+ ### How It Works
46
+
47
+ ```
48
+ 1. Package images → references.vref
49
+ 2. Upload to AI platform
50
+ 3. Platform samples N random images
51
+ 4. You write text prompt
52
+ 5. AI generates with visual context
53
+ ```
54
+
55
+ Instead of fighting with text descriptions, you **show the AI what you want**.
9
56
 
10
57
  ---
11
58
 
12
- ## What is VREF?
59
+ <div align="center">
60
+
61
+ ## Why You Should Use VREF
13
62
 
14
- VREF (Visual Reference Format) is an open standard for packaging and sharing curated visual references for AI image generation platforms.
63
+ </div>
15
64
 
16
- Instead of uploading multiple loose images or struggling to describe complex visual concepts in text, users can:
65
+ ### ✅ For Creators
17
66
 
18
- 1. **Package** reference images into a single `.vref` file
19
- 2. **Upload** the `.vref` to any supporting AI platform
20
- 3. **Select** how many random references to use (via slider)
21
- 4. **Generate** images with visual context
67
+ **Stop struggling with prompts.**
68
+ - Package your mood boards, style references, and inspirations
69
+ - Upload once, reuse forever
70
+ - Share with your team or community
22
71
 
23
- ### The Problem
72
+ **Example:** Download `roblox-banners.vref` → Upload → Describe what you want → Get perfect results
24
73
 
25
- When generating images with AI, users often:
26
- - ❌ Know what they want visually but can't describe it in words
27
- - ❌ Need to upload 10-50 reference images individually
28
- - ❌ Can't easily share or reuse reference collections
29
- - ❌ Struggle to communicate style, mood, and composition
74
+ ### ✅ For Platforms
30
75
 
31
- ### The Solution
76
+ **Better user experience.**
77
+ - Users get better results faster
78
+ - Reduces prompt engineering frustration
79
+ - Differentiates your platform
80
+ - Simple to implement (< 1 day)
32
81
 
33
- VREF provides:
34
- - ✅ **Single file** container for multiple images
35
- - ✅ **Validated** image-only format
36
- - ✅ **Structured metadata** (tags, description, license)
37
- - ✅ **Portable** and shareable
38
- - ✅ **Random sampling** built-in
39
- - ✅ **Open standard** anyone can implement
82
+ ### ✅ For Everyone
83
+
84
+ **It's an open standard.**
85
+ - No vendor lock-in
86
+ - Portable across platforms
87
+ - Community-driven
88
+ - Free forever
40
89
 
41
90
  ---
42
91
 
92
+ <div align="center">
93
+
94
+ ## Real-World Use Cases
95
+
96
+ </div>
97
+
98
+ ### 🎮 Game Development
99
+ ```
100
+ rpg-sprites.vref → Character references
101
+ platformer-tiles.vref → Level design inspiration
102
+ ui-elements.vref → Interface styles
103
+ ```
104
+
105
+ ### 🎨 Creative Work
106
+ ```
107
+ architecture.vref → Building styles
108
+ color-palettes.vref → Mood and tone
109
+ typography.vref → Font and layout ideas
110
+ ```
111
+
112
+ ### 🤖 AI Training
113
+ ```
114
+ training-data.vref → Curated datasets
115
+ style-transfer.vref → Style references
116
+ fine-tuning.vref → Model-specific data
117
+ ```
118
+
119
+ ---
120
+
121
+ <div align="center">
122
+
43
123
  ## Installation
44
124
 
125
+ </div>
126
+
45
127
  ```bash
46
128
  npm install @harpiaresearch/vref
47
129
  ```
48
130
 
49
- Or use directly with `npx`:
131
+ Or use directly:
50
132
 
51
133
  ```bash
52
- npx create-vref
134
+ npx @harpiaresearch/vref
53
135
  ```
54
136
 
55
137
  ---
56
138
 
139
+ <div align="center">
140
+
57
141
  ## Quick Start
58
142
 
59
- ### Creating a .vref file (CLI)
143
+ </div>
144
+
145
+ ### Creating a .vref File
60
146
 
147
+ **CLI:**
61
148
  ```bash
62
- # From a directory of images
63
- npx create-vref ./my-images -o references.vref
149
+ # From a directory
150
+ npx @harpiaresearch/vref ./my-images -o references.vref
64
151
 
65
152
  # With metadata
66
- npx create-vref ./images -o pack.vref \
153
+ npx @harpiaresearch/vref ./images -o pack.vref \
67
154
  -n "My Reference Pack" \
68
- -d "Collection of visual references for X" \
69
- -t "style,mood,theme" \
70
- -a "Your Name" \
71
- -l "CC-BY-4.0"
72
-
73
- # From a single image
74
- npx create-vref image.png -o single.vref
155
+ -d "Collection of art references" \
156
+ -t "art,style,inspiration"
75
157
  ```
76
158
 
77
- ### Using the library (JavaScript/TypeScript)
78
-
79
- **Creating a .vref file:**
80
-
159
+ **Code:**
81
160
  ```typescript
82
161
  import { VREFWriter } from '@harpiaresearch/vref';
83
162
 
84
163
  const writer = new VREFWriter({
85
- fileName: 'my-pack.vref',
86
- description: 'Collection of RPG character references',
87
- tags: ['rpg', 'characters', 'fantasy'],
88
- author: 'Your Name',
89
- license: 'CC-BY-4.0',
164
+ fileName: 'references.vref',
165
+ description: 'Art style references',
166
+ tags: ['art', 'style'],
90
167
  });
91
168
 
92
- // Add images from directory
93
- writer.addImagesFromDirectory('./images', true);
94
-
95
- // Or add individual images
96
- writer.addImageFromFile('./image1.png');
97
- writer.addImage('image2.jpg', imageBuffer);
98
-
99
- // Write the .vref file
100
- writer.write('output.vref');
101
-
102
- console.log(`Created .vref with ${writer.getImageCount()} images`);
169
+ writer.addImagesFromDirectory('./images');
170
+ writer.write('references.vref');
103
171
  ```
104
172
 
105
- **Reading a .vref file:**
173
+ ### Reading a .vref File
106
174
 
107
175
  ```typescript
108
176
  import { VREFReader } from '@harpiaresearch/vref';
109
177
 
110
- // Read the entire .vref file
178
+ // Read file
111
179
  const vref = VREFReader.read('references.vref', { loadImages: true });
112
180
 
113
181
  console.log(`Loaded ${vref.manifest.imageCount} images`);
114
- console.log(`Description: ${vref.manifest.metadata?.description}`);
115
182
 
116
- // Get random sample of 3 images
117
- const randomImages = vref.sample(3);
118
- randomImages.forEach((buffer, idx) => {
119
- console.log(`Image ${idx + 1}: ${buffer.length} bytes`);
120
- });
183
+ // Sample 3 random images
184
+ const randomSamples = vref.sample(3);
121
185
 
122
186
  // Get specific image
123
187
  const image = vref.getImage('photo1.png');
124
- if (image) {
125
- // Do something with the image buffer
126
- }
127
- ```
128
-
129
- **Read only the manifest:**
130
-
131
- ```typescript
132
- import { VREFReader } from '@harpiaresearch/vref';
133
-
134
- const manifest = VREFReader.readManifest('references.vref');
135
- console.log(manifest);
136
- ```
137
-
138
- **Validate a .vref file:**
139
-
140
- ```typescript
141
- import { VREFReader } from '@harpiaresearch/vref';
142
-
143
- const result = VREFReader.validate('references.vref');
144
- if (result.valid) {
145
- console.log('✅ Valid .vref file');
146
- } else {
147
- console.error('❌ Invalid .vref file:');
148
- result.errors.forEach(err => console.error(` - ${err}`));
149
- }
150
188
  ```
151
189
 
152
190
  ---
153
191
 
154
- ## Use Cases
155
-
156
- ### 1. **AI Image Generation Platforms**
192
+ <div align="center">
157
193
 
158
- Users upload `.vref` files to platforms like:
159
- - Midjourney
160
- - Stable Diffusion
161
- - DALL-E
162
- - Replicate
163
- - Custom AI platforms
194
+ ## For AI Platform Developers
164
195
 
165
- The platform extracts random images and sends them as visual context along with the user's text prompt.
196
+ Integrating VREF takes **< 1 day**:
166
197
 
167
- ### 2. **Game Development**
198
+ </div>
168
199
 
169
- Distribute reference packs:
170
- - `rpg-sprites.vref` — Character sprites for RPG games
171
- - `platformer-tiles.vref` — Tile sets for platformers
172
- - `ui-elements.vref` — UI design references
200
+ ```typescript
201
+ import { VREFReader } from '@harpiaresearch/vref';
173
202
 
174
- ### 3. **Training ML Models**
203
+ // 1. User uploads .vref
204
+ const vref = VREFReader.read(uploadedFile, { loadImages: true });
175
205
 
176
- Use `.vref` files as datasets:
206
+ // 2. Show slider: "How many references? (1-{imageCount})"
207
+ const count = getUserSliderValue();
177
208
 
178
- ```typescript
179
- import { VREFReader } from '@harpiaresearch/vref';
180
- import { PixelGenModel } from '@harpiaresearch/pixelgen';
209
+ // 3. Sample random images
210
+ const references = vref.sample(count);
181
211
 
182
- const dataset = VREFReader.read('training-data.vref', { loadImages: true });
183
- const model = new PixelGenModel(3, 3);
212
+ // 4. Get user prompt
213
+ const prompt = getUserPrompt();
184
214
 
185
- // Train with VREF data
186
- // ...
215
+ // 5. Send to your AI
216
+ await generateImage({
217
+ prompt: prompt,
218
+ referenceImages: references,
219
+ });
187
220
  ```
188
221
 
189
- ### 4. **Design & Creative Work**
190
-
191
- Share mood boards and references:
192
- - `architecture-modern.vref`
193
- - `color-palettes-warm.vref`
194
- - `typography-references.vref`
222
+ **That's it.** ✅
195
223
 
196
224
  ---
197
225
 
198
- ## File Format Specification
226
+ ## File Format
199
227
 
200
228
  A `.vref` file is a ZIP container with:
201
229
 
202
230
  ```
203
- my-pack.vref (ZIP)
204
- ├── manifest.json
231
+ references.vref
232
+ ├── manifest.json (metadata)
205
233
  ├── image1.png
206
234
  ├── image2.jpg
207
- ├── image3.webp
208
- └── ...
235
+ └── image3.webp
209
236
  ```
210
237
 
211
- ### `manifest.json` Structure
238
+ **Supported formats:** PNG, JPEG, WebP, GIF, AVIF
239
+
240
+ **Only images allowed.** Any other file type is rejected.
241
+
242
+ ### manifest.json
212
243
 
213
244
  ```json
214
245
  {
215
246
  "version": "1.0.0",
216
247
  "format": "VREF",
217
- "fileName": "my-pack.vref",
248
+ "fileName": "references.vref",
218
249
  "imageCount": 24,
219
250
  "images": [
220
251
  {
@@ -227,29 +258,43 @@ my-pack.vref (ZIP)
227
258
  ],
228
259
  "createdAt": "2024-10-12T10:30:00.000Z",
229
260
  "metadata": {
230
- "description": "Collection of X references",
231
- "tags": ["tag1", "tag2"],
232
- "author": "Author Name",
261
+ "description": "Collection of references",
262
+ "tags": ["style", "mood"],
263
+ "author": "Your Name",
233
264
  "license": "CC-BY-4.0"
234
265
  }
235
266
  }
236
267
  ```
237
268
 
238
- ### Supported Image Formats
269
+ ---
239
270
 
240
- - ✅ PNG (`.png`)
241
- - ✅ JPEG (`.jpg`, `.jpeg`)
242
- - ✅ WebP (`.webp`)
243
- - ✅ GIF (`.gif`)
244
- - ✅ AVIF (`.avif`)
271
+ <div align="center">
245
272
 
246
- Any other file type is **rejected** with an error.
273
+ ## Why VREF Will Win
247
274
 
248
- ---
275
+ </div>
276
+
277
+ ### 🎯 Solves a Real Problem
278
+ Everyone who uses AI image generation has struggled with describing visual concepts. VREF makes it trivial.
279
+
280
+ ### 🚀 Simple to Implement
281
+ ZIP + JSON. No complex dependencies. Works everywhere.
282
+
283
+ ### 🌍 Open Standard
284
+ No company owns it. Community-driven. Free forever.
249
285
 
250
- ## API Reference
286
+ ### 📦 Already Shipping
287
+ - ✅ npm package published
288
+ - ✅ Full TypeScript support
289
+ - ✅ CLI tool ready
290
+ - ✅ Documentation complete
251
291
 
252
- ### `VREFWriter`
292
+ ### 🇧🇷 Made in Brazil
293
+ Harpia AI Research is putting Brazil on the map of AI innovation.
294
+
295
+ ---
296
+
297
+ ### VREFWriter
253
298
 
254
299
  ```typescript
255
300
  class VREFWriter {
@@ -261,11 +306,10 @@ class VREFWriter {
261
306
 
262
307
  write(outputPath: string): void;
263
308
  getImageCount(): number;
264
- clear(): void;
265
309
  }
266
310
  ```
267
311
 
268
- ### `VREFReader`
312
+ ### VREFReader
269
313
 
270
314
  ```typescript
271
315
  class VREFReader {
@@ -275,92 +319,88 @@ class VREFReader {
275
319
  }
276
320
  ```
277
321
 
278
- ### Types
279
-
280
- See [src/types.ts](src/types.ts) for complete type definitions.
281
-
282
- ---
283
-
284
- ## Platform Integration
285
-
286
- ### For AI Platform Developers
287
-
288
- Integrating VREF support:
322
+ ### VREFReadResult
289
323
 
290
324
  ```typescript
291
- import { VREFReader } from '@harpiaresearch/vref';
325
+ interface VREFReadResult {
326
+ manifest: VREFManifest;
327
+ images?: Map<string, Buffer>;
328
+ sample: (count: number) => Buffer[];
329
+ getImage: (path: string) => Buffer | undefined;
330
+ }
331
+ ```
292
332
 
293
- // 1. User uploads .vref file
294
- const vref = VREFReader.read(uploadedFile, { loadImages: true });
333
+ Full API documentation: [TypeScript definitions](src/types.ts)
295
334
 
296
- // 2. Show slider: "How many references? (1 - {vref.manifest.imageCount})"
297
- const userSelectedCount = getUserSliderValue(); // e.g., 3
335
+ ---
298
336
 
299
- // 3. Sample random images
300
- const selectedImages = vref.sample(userSelectedCount);
337
+ ## Roadmap
301
338
 
302
- // 4. Get user's text prompt
303
- const userPrompt = getUserPrompt(); // "A warrior character in pixel art style"
339
+ ### Phase 1 ✅ (Done)
340
+ - Core library implementation
341
+ - CLI tool
342
+ - npm package published
343
+ - Full documentation
304
344
 
305
- // 5. Send to your AI model
306
- await generateImage({
307
- prompt: userPrompt,
308
- referenceImages: selectedImages,
309
- });
310
- ```
345
+ ### Phase 2 (In Progress)
346
+ - Community-created .vref files
347
+ - Platform integrations
348
+ - Example collections
311
349
 
312
- That's it! 🎉
350
+ ### Phase 3 (Future)
351
+ - Web-based .vref creator
352
+ - .vref marketplace
353
+ - Browser extensions
354
+ - Mobile support
313
355
 
314
356
  ---
315
357
 
316
- ## Examples
358
+ ## Join the Movement
317
359
 
318
- See the [examples/](examples/) directory for:
319
- - Creating `.vref` files
320
- - Reading and sampling images
321
- - Platform integration examples
322
- - PixelGen integration
360
+ VREF is just getting started. We need:
361
+
362
+ - **Platform developers**: Integrate VREF support
363
+ - **Creators**: Build and share .vref collections
364
+ - **Contributors**: Improve the library
365
+ - **Evangelists**: Spread the word
323
366
 
324
367
  ---
325
368
 
326
- ## Contributing
369
+ ## Links
327
370
 
328
- We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
371
+ - **npm**: https://www.npmjs.com/package/@harpiaresearch/vref
372
+ - **GitHub**: https://github.com/Harpia-AI-Research/vref
373
+ - **Harpia AI Research**: https://harpiaresearch.cc
374
+ - **Issues**: https://github.com/Harpia-AI-Research/vref/issues
329
375
 
330
376
  ---
331
377
 
332
378
  ## License
333
379
 
334
- BSD 3-Clause License
380
+ This project is licensed under the **BSD 3-Clause License** - see the [LICENSE](LICENSE) file for details.
335
381
 
336
382
  Copyright (c) 2024, Harpia AI Research
337
383
 
338
- See [LICENSE](LICENSE) for full text.
339
-
340
384
  ---
341
385
 
342
- ## Citation
386
+ ## Acknowledgments
343
387
 
344
- If you use VREF in your research or project:
388
+ VREF is an open standard for visual references in AI systems. Built to solve the gap between what creators envision and what they can describe in text.
345
389
 
346
- ```bibtex
347
- @software{vref2024,
348
- title = {VREF: Visual Reference Format for AI Image Generation},
349
- author = {Harpia AI Research},
350
- year = {2024},
351
- url = {https://github.com/Harpia-AI-Research/vref}
352
- }
353
- ```
390
+ **Technologies**: TypeScript, Node.js, adm-zip
354
391
 
355
392
  ---
356
393
 
357
- ## Links
394
+ <div align="center">
358
395
 
359
- - 🌐 Website: [harpiaresearch.cc](https://harpiaresearch.cc)
360
- - 📦 npm: [@harpiaresearch/vref](https://www.npmjs.com/package/@harpiaresearch/vref)
361
- - 📄 Specification: [docs/SPECIFICATION.md](docs/SPECIFICATION.md)
362
- - 💬 Issues: [GitHub Issues](https://github.com/Harpia-AI-Research/vref/issues)
396
+ **VREF** — Bridging vision and AI generation
363
397
 
364
- ---
398
+ <br><br>
399
+
400
+ [GitHub](https://github.com/Harpia-AI-Research/vref) •
401
+ [npm](https://www.npmjs.com/package/@harpiaresearch/vref) •
402
+ [Documentation](https://github.com/Harpia-AI-Research/vref#readme) •
403
+ [Issues](https://github.com/Harpia-AI-Research/vref/issues)
404
+
405
+ </div>
365
406
 
366
- **Made with 💚💛 by Harpia AI Research — São Paulo, Brazil** 🇧🇷
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpiaresearch/vref",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Visual Reference Format - Standardized container for curated visual references in AI image generation",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",