@enslo/sd-metadata 2.1.1 → 2.3.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/CHANGELOG.md +41 -0
- package/README.ja.md +9 -4
- package/README.md +10 -5
- package/dist/index.d.ts +167 -189
- package/dist/index.d.ts.map +1 -0
- package/dist/index.global.js +8 -8
- package/dist/index.js +4356 -3036
- package/dist/index.js.map +1 -1
- package/docs/types.ja.md +48 -45
- package/docs/types.md +49 -46
- package/package.json +8 -8
package/docs/types.ja.md
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
- [コア型](#コア型)
|
|
10
10
|
- [`ParseResult`](#parseresult)
|
|
11
|
-
- [`BaseMetadata`](#basemetadata)
|
|
12
11
|
- [`GenerationMetadata`](#generationmetadata)
|
|
13
12
|
- [`GenerationSoftware`](#generationsoftware)
|
|
14
13
|
- [`EmbedMetadata`](#embedmetadata)
|
|
15
14
|
- [`RawMetadata`](#rawmetadata)
|
|
16
15
|
- [`WriteResult`](#writeresult)
|
|
17
16
|
- [メタデータ型](#メタデータ型)
|
|
17
|
+
- [`BaseMetadata`](#basemetadata)
|
|
18
18
|
- [`StandardMetadata`](#standardmetadata)
|
|
19
19
|
- [`NovelAIMetadata`](#novelaimetadata)
|
|
20
20
|
- [`ComfyUIMetadata`](#comfyuimetadata)
|
|
@@ -92,46 +92,6 @@ switch (result.status) {
|
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
95
|
-
### `BaseMetadata`
|
|
96
|
-
|
|
97
|
-
全メタデータ型で共有される共通フィールド。`GenerationMetadata` の各バリアントと `EmbedMetadata` の基盤です。
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
export interface BaseMetadata {
|
|
101
|
-
/** ポジティブプロンプト */
|
|
102
|
-
prompt: string;
|
|
103
|
-
/** ネガティブプロンプト */
|
|
104
|
-
negativePrompt: string;
|
|
105
|
-
/** 画像の幅(ピクセル) */
|
|
106
|
-
width: number;
|
|
107
|
-
/** 画像の高さ(ピクセル) */
|
|
108
|
-
height: number;
|
|
109
|
-
/** モデル設定 */
|
|
110
|
-
model?: ModelSettings;
|
|
111
|
-
/** サンプリング設定 */
|
|
112
|
-
sampling?: SamplingSettings;
|
|
113
|
-
/** Hires.fix設定(適用されている場合) */
|
|
114
|
-
hires?: HiresSettings;
|
|
115
|
-
/** アップスケール設定(適用されている場合) */
|
|
116
|
-
upscale?: UpscaleSettings;
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**例:**
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
import type { BaseMetadata } from '@enslo/sd-metadata';
|
|
124
|
-
|
|
125
|
-
// 共通の生成フィールドのみ必要な場合にBaseMetadataを使用
|
|
126
|
-
function displayMetadata(meta: BaseMetadata) {
|
|
127
|
-
console.log('Prompt:', meta.prompt);
|
|
128
|
-
console.log('Size:', meta.width, 'x', meta.height);
|
|
129
|
-
console.log('Model:', meta.model?.name);
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
95
|
### `GenerationMetadata`
|
|
136
96
|
|
|
137
97
|
統一されたメタデータ構造。サポートされている全てのメタデータ型のユニオン型。全バリアントが `BaseMetadata` を拡張しています。
|
|
@@ -147,7 +107,7 @@ type GenerationMetadata =
|
|
|
147
107
|
|
|
148
108
|
| メタデータ型 | `software` 値 |
|
|
149
109
|
| ------------- | ----------------- |
|
|
150
|
-
| `StandardMetadata` | `'sd-webui'` \| `'sd-next'` \| `'forge'` \| `'forge-classic'` \| `'forge-neo'` \| `'reforge'` \| `'easy-reforge'` \| `'invokeai'` \| `'civitai'` \| `'hf-space'` \| `'easydiffusion'` \| `'fooocus'` \| `'ruined-fooocus'` |
|
|
110
|
+
| `StandardMetadata` | `'sd-webui'` \| `'sd-next'` \| `'forge'` \| `'forge-classic'` \| `'forge-neo'` \| `'reforge'` \| `'easy-reforge'` \| `'invokeai'` \| `'civitai'` \| `'hf-space'` \| `'easydiffusion'` \| `'fooocus'` \| `'ruined-fooocus'` \| `'draw-things'` |
|
|
151
111
|
| `NovelAIMetadata` | `'novelai'` |
|
|
152
112
|
| `ComfyUIMetadata` | `'comfyui'` \| `'tensorart'` \| `'stability-matrix'` \| `'swarmui'` |
|
|
153
113
|
|
|
@@ -195,7 +155,8 @@ type GenerationSoftware =
|
|
|
195
155
|
| 'hf-space'
|
|
196
156
|
| 'easydiffusion'
|
|
197
157
|
| 'fooocus'
|
|
198
|
-
| 'ruined-fooocus'
|
|
158
|
+
| 'ruined-fooocus'
|
|
159
|
+
| 'draw-things';
|
|
199
160
|
```
|
|
200
161
|
|
|
201
162
|
**例:**
|
|
@@ -342,6 +303,46 @@ export type WriteWarning = {
|
|
|
342
303
|
|
|
343
304
|
## メタデータ型
|
|
344
305
|
|
|
306
|
+
### `BaseMetadata`
|
|
307
|
+
|
|
308
|
+
全メタデータ型で共有される共通フィールド。`GenerationMetadata` の各バリアントと `EmbedMetadata` の基盤です。
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
export interface BaseMetadata {
|
|
312
|
+
/** ポジティブプロンプト */
|
|
313
|
+
prompt: string;
|
|
314
|
+
/** ネガティブプロンプト */
|
|
315
|
+
negativePrompt: string;
|
|
316
|
+
/** 画像の幅(ピクセル) */
|
|
317
|
+
width: number;
|
|
318
|
+
/** 画像の高さ(ピクセル) */
|
|
319
|
+
height: number;
|
|
320
|
+
/** モデル設定 */
|
|
321
|
+
model?: ModelSettings;
|
|
322
|
+
/** サンプリング設定 */
|
|
323
|
+
sampling?: SamplingSettings;
|
|
324
|
+
/** Hires.fix設定(適用されている場合) */
|
|
325
|
+
hires?: HiresSettings;
|
|
326
|
+
/** アップスケール設定(適用されている場合) */
|
|
327
|
+
upscale?: UpscaleSettings;
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**例:**
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import type { BaseMetadata } from '@enslo/sd-metadata';
|
|
335
|
+
|
|
336
|
+
// 共通の生成フィールドのみ必要な場合にBaseMetadataを使用
|
|
337
|
+
function displayMetadata(meta: BaseMetadata) {
|
|
338
|
+
console.log('Prompt:', meta.prompt);
|
|
339
|
+
console.log('Size:', meta.width, 'x', meta.height);
|
|
340
|
+
console.log('Model:', meta.model?.name);
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
345
346
|
### `StandardMetadata`
|
|
346
347
|
|
|
347
348
|
ほとんどのSDツールで使用される標準パラメータフォーマット。
|
|
@@ -361,7 +362,8 @@ export interface StandardMetadata extends BaseMetadata {
|
|
|
361
362
|
| 'hf-space'
|
|
362
363
|
| 'easydiffusion'
|
|
363
364
|
| 'fooocus'
|
|
364
|
-
| 'ruined-fooocus'
|
|
365
|
+
| 'ruined-fooocus'
|
|
366
|
+
| 'draw-things';
|
|
365
367
|
}
|
|
366
368
|
```
|
|
367
369
|
|
|
@@ -788,7 +790,8 @@ export type MetadataSegmentSource =
|
|
|
788
790
|
| { type: 'exifUserComment' }
|
|
789
791
|
| { type: 'exifImageDescription'; prefix?: string }
|
|
790
792
|
| { type: 'exifMake'; prefix?: string }
|
|
791
|
-
| { type: 'jpegCom' }
|
|
793
|
+
| { type: 'jpegCom' }
|
|
794
|
+
| { type: 'xmpPacket' };
|
|
792
795
|
```
|
|
793
796
|
|
|
794
797
|
正確なラウンドトリップのために、JPEG/WebPファイル内のメタデータの出所を追跡します。
|
package/docs/types.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Type Documentation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
🌐 **[日本語版はこちら](./types.ja.md)**
|
|
4
4
|
|
|
5
5
|
Complete type reference for `@enslo/sd-metadata`.
|
|
6
6
|
|
|
@@ -8,13 +8,13 @@ Complete type reference for `@enslo/sd-metadata`.
|
|
|
8
8
|
|
|
9
9
|
- [Core Types](#core-types)
|
|
10
10
|
- [`ParseResult`](#parseresult)
|
|
11
|
-
- [`BaseMetadata`](#basemetadata)
|
|
12
11
|
- [`GenerationMetadata`](#generationmetadata)
|
|
13
12
|
- [`GenerationSoftware`](#generationsoftware)
|
|
14
13
|
- [`EmbedMetadata`](#embedmetadata)
|
|
15
14
|
- [`RawMetadata`](#rawmetadata)
|
|
16
15
|
- [`WriteResult`](#writeresult)
|
|
17
16
|
- [Metadata Types](#metadata-types)
|
|
17
|
+
- [`BaseMetadata`](#basemetadata)
|
|
18
18
|
- [`StandardMetadata`](#standardmetadata)
|
|
19
19
|
- [`NovelAIMetadata`](#novelaimetadata)
|
|
20
20
|
- [`ComfyUIMetadata`](#comfyuimetadata)
|
|
@@ -92,46 +92,6 @@ switch (result.status) {
|
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
95
|
-
### `BaseMetadata`
|
|
96
|
-
|
|
97
|
-
Common fields shared by all metadata types. This is the foundation for both `GenerationMetadata` variants and `EmbedMetadata`.
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
export interface BaseMetadata {
|
|
101
|
-
/** Positive prompt */
|
|
102
|
-
prompt: string;
|
|
103
|
-
/** Negative prompt */
|
|
104
|
-
negativePrompt: string;
|
|
105
|
-
/** Image width in pixels */
|
|
106
|
-
width: number;
|
|
107
|
-
/** Image height in pixels */
|
|
108
|
-
height: number;
|
|
109
|
-
/** Model settings */
|
|
110
|
-
model?: ModelSettings;
|
|
111
|
-
/** Sampling settings */
|
|
112
|
-
sampling?: SamplingSettings;
|
|
113
|
-
/** Hires.fix settings (if applied) */
|
|
114
|
-
hires?: HiresSettings;
|
|
115
|
-
/** Upscale settings (if applied) */
|
|
116
|
-
upscale?: UpscaleSettings;
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**Example:**
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
import type { BaseMetadata } from '@enslo/sd-metadata';
|
|
124
|
-
|
|
125
|
-
// Use BaseMetadata when you only need common generation fields
|
|
126
|
-
function displayMetadata(meta: BaseMetadata) {
|
|
127
|
-
console.log('Prompt:', meta.prompt);
|
|
128
|
-
console.log('Size:', meta.width, 'x', meta.height);
|
|
129
|
-
console.log('Model:', meta.model?.name);
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
95
|
### `GenerationMetadata`
|
|
136
96
|
|
|
137
97
|
Unified metadata structure. Discriminated union of all supported metadata types. All variants extend `BaseMetadata`.
|
|
@@ -147,7 +107,7 @@ type GenerationMetadata =
|
|
|
147
107
|
|
|
148
108
|
| Metadata Type | `software` values |
|
|
149
109
|
| ------------- | ----------------- |
|
|
150
|
-
| `StandardMetadata` | `'sd-webui'` \| `'sd-next'` \| `'forge'` \| `'forge-classic'` \| `'forge-neo'` \| `'reforge'` \| `'easy-reforge'` \| `'invokeai'` \| `'civitai'` \| `'hf-space'` \| `'easydiffusion'` \| `'fooocus'` \| `'ruined-fooocus'` |
|
|
110
|
+
| `StandardMetadata` | `'sd-webui'` \| `'sd-next'` \| `'forge'` \| `'forge-classic'` \| `'forge-neo'` \| `'reforge'` \| `'easy-reforge'` \| `'invokeai'` \| `'civitai'` \| `'hf-space'` \| `'easydiffusion'` \| `'fooocus'` \| `'ruined-fooocus'` \| `'draw-things'` |
|
|
151
111
|
| `NovelAIMetadata` | `'novelai'` |
|
|
152
112
|
| `ComfyUIMetadata` | `'comfyui'` \| `'tensorart'` \| `'stability-matrix'` \| `'swarmui'` |
|
|
153
113
|
|
|
@@ -195,7 +155,8 @@ type GenerationSoftware =
|
|
|
195
155
|
| 'hf-space'
|
|
196
156
|
| 'easydiffusion'
|
|
197
157
|
| 'fooocus'
|
|
198
|
-
| 'ruined-fooocus'
|
|
158
|
+
| 'ruined-fooocus'
|
|
159
|
+
| 'draw-things';
|
|
199
160
|
```
|
|
200
161
|
|
|
201
162
|
**Example:**
|
|
@@ -342,6 +303,46 @@ Returned when metadata was intentionally dropped during a write operation (e.g.,
|
|
|
342
303
|
|
|
343
304
|
## Metadata Types
|
|
344
305
|
|
|
306
|
+
### `BaseMetadata`
|
|
307
|
+
|
|
308
|
+
Common fields shared by all metadata types. This is the foundation for both `GenerationMetadata` variants and `EmbedMetadata`.
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
export interface BaseMetadata {
|
|
312
|
+
/** Positive prompt */
|
|
313
|
+
prompt: string;
|
|
314
|
+
/** Negative prompt */
|
|
315
|
+
negativePrompt: string;
|
|
316
|
+
/** Image width in pixels */
|
|
317
|
+
width: number;
|
|
318
|
+
/** Image height in pixels */
|
|
319
|
+
height: number;
|
|
320
|
+
/** Model settings */
|
|
321
|
+
model?: ModelSettings;
|
|
322
|
+
/** Sampling settings */
|
|
323
|
+
sampling?: SamplingSettings;
|
|
324
|
+
/** Hires.fix settings (if applied) */
|
|
325
|
+
hires?: HiresSettings;
|
|
326
|
+
/** Upscale settings (if applied) */
|
|
327
|
+
upscale?: UpscaleSettings;
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Example:**
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import type { BaseMetadata } from '@enslo/sd-metadata';
|
|
335
|
+
|
|
336
|
+
// Use BaseMetadata when you only need common generation fields
|
|
337
|
+
function displayMetadata(meta: BaseMetadata) {
|
|
338
|
+
console.log('Prompt:', meta.prompt);
|
|
339
|
+
console.log('Size:', meta.width, 'x', meta.height);
|
|
340
|
+
console.log('Model:', meta.model?.name);
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
345
346
|
### `StandardMetadata`
|
|
346
347
|
|
|
347
348
|
Standard parameters format used by most SD tools.
|
|
@@ -361,7 +362,8 @@ export interface StandardMetadata extends BaseMetadata {
|
|
|
361
362
|
| 'hf-space'
|
|
362
363
|
| 'easydiffusion'
|
|
363
364
|
| 'fooocus'
|
|
364
|
-
| 'ruined-fooocus'
|
|
365
|
+
| 'ruined-fooocus'
|
|
366
|
+
| 'draw-things';
|
|
365
367
|
}
|
|
366
368
|
```
|
|
367
369
|
|
|
@@ -788,7 +790,8 @@ export type MetadataSegmentSource =
|
|
|
788
790
|
| { type: 'exifUserComment' }
|
|
789
791
|
| { type: 'exifImageDescription'; prefix?: string }
|
|
790
792
|
| { type: 'exifMake'; prefix?: string }
|
|
791
|
-
| { type: 'jpegCom' }
|
|
793
|
+
| { type: 'jpegCom' }
|
|
794
|
+
| { type: 'xmpPacket' };
|
|
792
795
|
```
|
|
793
796
|
|
|
794
797
|
Tracks where the metadata came from in JPEG/WebP files for accurate round-tripping.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enslo/sd-metadata",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Read and write AI-generated image metadata",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"CHANGELOG.md"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "
|
|
22
|
+
"build": "tsdown",
|
|
23
23
|
"test": "vitest run",
|
|
24
24
|
"test:watch": "vitest",
|
|
25
25
|
"test:coverage": "vitest run --coverage",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"homepage": "https://sd-metadata.pages.dev",
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@biomejs/biome": "
|
|
57
|
-
"@types/node": "
|
|
58
|
-
"@vitest/coverage-v8": "^4.
|
|
59
|
-
"
|
|
60
|
-
"typescript": "
|
|
61
|
-
"vitest": "
|
|
56
|
+
"@biomejs/biome": "catalog:",
|
|
57
|
+
"@types/node": "catalog:",
|
|
58
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
59
|
+
"tsdown": "catalog:",
|
|
60
|
+
"typescript": "catalog:",
|
|
61
|
+
"vitest": "catalog:"
|
|
62
62
|
}
|
|
63
63
|
}
|