@teamflojo/floimg-stability 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -0
  3. package/package.json +11 -12
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Brett Cooke
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 ADDED
@@ -0,0 +1,154 @@
1
+ # @teamflojo/floimg-stability
2
+
3
+ Stability AI integration for floimg, providing Stable Diffusion image generation and AI-powered transforms.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @teamflojo/floimg-stability
9
+ # or
10
+ pnpm add @teamflojo/floimg-stability
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ Set your Stability AI API key:
16
+
17
+ ```bash
18
+ export STABILITY_API_KEY=your_key_here
19
+ ```
20
+
21
+ Or pass it directly:
22
+
23
+ ```typescript
24
+ import stability from "@teamflojo/floimg-stability";
25
+
26
+ const generator = stability({ apiKey: "your_key_here" });
27
+ ```
28
+
29
+ ## Features
30
+
31
+ ### Image Generation (SDXL / SD3)
32
+
33
+ Generate images using Stable Diffusion models:
34
+
35
+ ```typescript
36
+ import { createClient } from "@teamflojo/floimg";
37
+ import stability from "@teamflojo/floimg-stability";
38
+
39
+ const floimg = createClient();
40
+ floimg.registerGenerator(stability());
41
+
42
+ const image = await floimg.generate({
43
+ generator: "stability",
44
+ params: {
45
+ prompt: "A majestic lion in the savanna",
46
+ negativePrompt: "blurry, low quality",
47
+ model: "sd3-large",
48
+ size: "1024x1024",
49
+ stylePreset: "photographic",
50
+ },
51
+ });
52
+ ```
53
+
54
+ **Parameters:**
55
+
56
+ | Parameter | Type | Default | Description |
57
+ | -------------- | ------ | ----------- | ---------------------------------------- |
58
+ | prompt | string | (required) | Image description |
59
+ | negativePrompt | string | - | What to avoid |
60
+ | model | string | "sd3-large" | Model variant |
61
+ | size | string | "1024x1024" | Image dimensions |
62
+ | stylePreset | string | - | Style preset (photographic, anime, etc.) |
63
+ | cfgScale | number | 7 | Prompt adherence (1-35) |
64
+ | steps | number | 30 | Inference steps |
65
+ | seed | number | - | Reproducibility seed |
66
+
67
+ ### Image Transforms
68
+
69
+ AI-powered image transformations:
70
+
71
+ ```typescript
72
+ import { stabilityTransform } from "@teamflojo/floimg-stability";
73
+
74
+ floimg.registerTransformProvider(stabilityTransform());
75
+ ```
76
+
77
+ **Available Transforms:**
78
+
79
+ #### Remove Background
80
+
81
+ Remove the background from an image:
82
+
83
+ ```typescript
84
+ const result = await floimg.transform({
85
+ blob: inputImage,
86
+ op: "removeBackground",
87
+ provider: "stability-transform",
88
+ });
89
+ ```
90
+
91
+ #### Upscale (Creative Upscale)
92
+
93
+ AI-powered 4x upscaling:
94
+
95
+ ```typescript
96
+ const result = await floimg.transform({
97
+ blob: inputImage,
98
+ op: "upscale",
99
+ provider: "stability-transform",
100
+ params: {
101
+ prompt: "high quality, detailed", // Optional guidance
102
+ creativity: 0.3, // 0-0.35
103
+ },
104
+ });
105
+ ```
106
+
107
+ #### Search and Replace
108
+
109
+ Find and replace objects in an image:
110
+
111
+ ```typescript
112
+ const result = await floimg.transform({
113
+ blob: inputImage,
114
+ op: "searchAndReplace",
115
+ provider: "stability-transform",
116
+ params: {
117
+ prompt: "a golden retriever",
118
+ searchPrompt: "the dog",
119
+ },
120
+ });
121
+ ```
122
+
123
+ #### Outpaint
124
+
125
+ Extend image boundaries:
126
+
127
+ ```typescript
128
+ const result = await floimg.transform({
129
+ blob: inputImage,
130
+ op: "outpaint",
131
+ provider: "stability-transform",
132
+ params: {
133
+ prompt: "continue the landscape",
134
+ left: 100,
135
+ right: 100,
136
+ up: 0,
137
+ down: 50,
138
+ creativity: 0.5,
139
+ },
140
+ });
141
+ ```
142
+
143
+ ## Transform Summary
144
+
145
+ | Operation | Description | Required Params |
146
+ | ---------------- | ------------------------ | -------------------- |
147
+ | removeBackground | Remove image background | - |
148
+ | upscale | 4x AI upscaling | - |
149
+ | searchAndReplace | Find and replace objects | prompt, searchPrompt |
150
+ | outpaint | Extend image boundaries | prompt |
151
+
152
+ ## License
153
+
154
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamflojo/floimg-stability",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Stability AI image generation plugin for floimg (SDXL, SD3)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,14 +16,6 @@
16
16
  "README.md",
17
17
  "LICENSE"
18
18
  ],
19
- "scripts": {
20
- "build": "tsc",
21
- "dev": "tsc --watch",
22
- "typecheck": "tsc --noEmit",
23
- "clean": "rm -rf dist",
24
- "prepublishOnly": "npm run build",
25
- "test": "vitest --run"
26
- },
27
19
  "keywords": [
28
20
  "floimg",
29
21
  "stability-ai",
@@ -45,11 +37,18 @@
45
37
  },
46
38
  "devDependencies": {
47
39
  "@types/node": "^22.10.2",
48
- "@teamflojo/floimg": "workspace:*",
49
40
  "typescript": "^5.7.2",
50
- "vitest": "^2.1.8"
41
+ "vitest": "^2.1.8",
42
+ "@teamflojo/floimg": "0.4.0"
51
43
  },
52
44
  "engines": {
53
45
  "node": ">=18.0.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc",
49
+ "dev": "tsc --watch",
50
+ "typecheck": "tsc --noEmit",
51
+ "clean": "rm -rf dist",
52
+ "test": "vitest --run"
54
53
  }
55
- }
54
+ }