picture-it 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.
- package/README.md +243 -0
- package/hero.png +0 -0
- package/index.ts +493 -0
- package/package.json +60 -0
- package/scripts/download-fonts.ts +14 -0
- package/src/compositor.ts +614 -0
- package/src/config.ts +102 -0
- package/src/contrast.ts +155 -0
- package/src/fal.ts +218 -0
- package/src/fonts.ts +165 -0
- package/src/model-router.ts +78 -0
- package/src/operations.ts +85 -0
- package/src/pipeline.ts +243 -0
- package/src/postprocess.ts +124 -0
- package/src/presets.ts +105 -0
- package/src/satori-jsx.ts +17 -0
- package/src/templates/index.ts +457 -0
- package/src/types.ts +226 -0
- package/src/zones.ts +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# picture-it
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Photoshop for AI agents. Composable image operations from the CLI.
|
|
6
|
+
|
|
7
|
+
Each command takes an image in, does one thing, and outputs an image. Chain them together to build any visual.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun install -g picture-it
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires Bun 1.3+.
|
|
16
|
+
|
|
17
|
+
One-off usage also works:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bunx picture-it@latest info -i image.png
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Setup
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
picture-it download-fonts
|
|
27
|
+
picture-it auth --fal <your-fal-key>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`download-fonts` is required for text and template commands.
|
|
31
|
+
|
|
32
|
+
## Local development
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bun install
|
|
36
|
+
bun run download-fonts
|
|
37
|
+
picture-it auth --fal <your-fal-key>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
### edit — The primary command
|
|
43
|
+
|
|
44
|
+
Edit any image with a natural language prompt. Uses FAL AI edit models.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Change a background
|
|
48
|
+
picture-it edit -i photo.jpg --prompt "replace background with modern hotel entrance" -o edited.jpg
|
|
49
|
+
|
|
50
|
+
# Composite logos into a scene
|
|
51
|
+
picture-it edit -i scene.png -i logo.png --prompt "place Figure 2 as a glowing 3D object in the center" -o hero.png
|
|
52
|
+
|
|
53
|
+
# Multi-image composition
|
|
54
|
+
picture-it edit -i bg.png -i logo1.png -i logo2.png \
|
|
55
|
+
--prompt "Place Figure 2 on left and Figure 3 on right in a dramatic VS layout" \
|
|
56
|
+
--model banana-pro -o comparison.png
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### generate — Create from scratch
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
picture-it generate --prompt "dark stage with green spotlight, cinematic" --size 1200x630 -o bg.png
|
|
63
|
+
picture-it generate --prompt "abstract gradient mesh" --platform instagram-square -o mesh.png
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### remove-bg / replace-bg
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
picture-it remove-bg -i product.jpg -o cutout.png
|
|
70
|
+
picture-it replace-bg -i photo.jpg --prompt "standing in front of a luxury hotel" -o new.jpg
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### crop
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
picture-it crop -i photo.png --size 1080x1080 --position center -o square.png
|
|
77
|
+
picture-it crop -i wide.png --size 1200x630 --position attention -o blog.png
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### grade / grain / vignette
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
picture-it grade -i photo.png --name cinematic -o graded.png
|
|
84
|
+
picture-it grain -i photo.png --intensity 0.05 -o grained.png
|
|
85
|
+
picture-it vignette -i photo.png --opacity 0.4 -o vignetted.png
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### text — Render text with Satori
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Simple mode
|
|
92
|
+
picture-it text -i bg.png --title "Ship Faster" --font "Space Grotesk" --color white --font-size 72 -o hero.png
|
|
93
|
+
|
|
94
|
+
# Advanced mode with JSX layout
|
|
95
|
+
picture-it text -i bg.png --jsx overlays.json -o hero.png
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### compose — Overlay compositing
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
picture-it compose -i background.png --overlays overlays.json -o result.png
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### template — No AI, instant output
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
picture-it template text-hero --title "Hello World" --subtitle "Built with picture-it" -o hero.png
|
|
108
|
+
picture-it template vs-comparison --left-logo a.png --right-logo b.png -o vs.png
|
|
109
|
+
picture-it template social-card --title "My Post" --site-name "example.com" -o card.png
|
|
110
|
+
picture-it template feature-hero --logo icon.png --title "Feature X" --glow-color "#3b82f6" -o feature.png
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### pipeline — Multi-step operations
|
|
114
|
+
|
|
115
|
+
Chain operations in a JSON spec. Each step feeds into the next.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
picture-it pipeline --spec steps.json -o final.png
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
[
|
|
123
|
+
{ "op": "generate", "prompt": "dark stage with green spotlight", "size": "1200x630" },
|
|
124
|
+
{ "op": "edit", "prompt": "place Figure 1 as a glowing cube in the spotlight", "assets": ["logo.png"] },
|
|
125
|
+
{ "op": "crop", "size": "1200x630" },
|
|
126
|
+
{ "op": "grade", "name": "cinematic" },
|
|
127
|
+
{ "op": "vignette" }
|
|
128
|
+
]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### batch — Multiple pipelines
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
picture-it batch --spec batch.json --output-dir ./images/
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
"id": "hero",
|
|
141
|
+
"pipeline": [
|
|
142
|
+
{ "op": "generate", "prompt": "abstract dark background", "size": "1200x630" },
|
|
143
|
+
{ "op": "grade", "name": "cinematic" }
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "card",
|
|
148
|
+
"pipeline": [
|
|
149
|
+
{ "op": "generate", "prompt": "gradient mesh", "size": "1200x630" },
|
|
150
|
+
{ "op": "text", "title": "My Title", "fontSize": 64 }
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### info — Analyze an image
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
picture-it info -i photo.png
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Outputs JSON: dimensions, format, transparency, dominant colors, content type guess.
|
|
163
|
+
|
|
164
|
+
### upscale
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
picture-it upscale -i small.png --scale 2 -o large.png
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Model routing
|
|
171
|
+
|
|
172
|
+
The tool automatically picks the cheapest model that can handle the job:
|
|
173
|
+
|
|
174
|
+
| Operation | Default model | Cost |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `generate` | flux-schnell | $0.003 |
|
|
177
|
+
| `edit` (1-10 images) | seedream | $0.04 |
|
|
178
|
+
| `edit` (>10 images) | banana2 | $0.08 |
|
|
179
|
+
| `edit --model banana-pro` | banana-pro | $0.15 |
|
|
180
|
+
| `remove-bg` | birefnet | — |
|
|
181
|
+
|
|
182
|
+
Override with `--model <name>` on any command.
|
|
183
|
+
|
|
184
|
+
## Platform presets
|
|
185
|
+
|
|
186
|
+
Use `--platform <name>` on `generate`, `crop`, or `template`:
|
|
187
|
+
|
|
188
|
+
| Preset | Size |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `blog-featured` | 1200x630 |
|
|
191
|
+
| `og-image` | 1200x630 |
|
|
192
|
+
| `twitter-header` | 1500x500 |
|
|
193
|
+
| `instagram-square` | 1080x1080 |
|
|
194
|
+
| `instagram-story` | 1080x1920 |
|
|
195
|
+
| `youtube-thumbnail` | 1280x720 |
|
|
196
|
+
| `linkedin-post` | 1200x627 |
|
|
197
|
+
|
|
198
|
+
## Output behavior
|
|
199
|
+
|
|
200
|
+
- **stdout**: only the output file path (or JSON for batch)
|
|
201
|
+
- **stderr**: progress logs and warnings
|
|
202
|
+
- **Exit 0** on success, **Exit 1** on failure
|
|
203
|
+
|
|
204
|
+
## Example workflows
|
|
205
|
+
|
|
206
|
+
### Blog hero with AI background
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
picture-it generate --prompt "dark cosmic background with subtle nebula" --size 1200x630 -o bg.png
|
|
210
|
+
picture-it edit -i bg.png -i logo.png --prompt "place Figure 2 as a large glowing element in center" --model seedream -o hero.png
|
|
211
|
+
picture-it grade -i hero.png --name cinematic -o hero-graded.png
|
|
212
|
+
picture-it vignette -i hero-graded.png -o final.png
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Instagram photo edit
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
picture-it edit -i photo.jpg --prompt "replace background with luxury hotel entrance, keep subject identical" --model banana-pro -o edited.jpg
|
|
219
|
+
picture-it crop -i edited.jpg --size 1080x1080 --position center -o square.jpg
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Product shot
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
picture-it remove-bg -i product.jpg -o cutout.png
|
|
226
|
+
picture-it replace-bg -i product.jpg --prompt "clean white studio background with soft shadows" -o studio.png
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Dependencies
|
|
230
|
+
|
|
231
|
+
- **Sharp** — image processing, compositing, post-processing
|
|
232
|
+
- **Satori** + **resvg-js** — text rendering (JSX → SVG → PNG)
|
|
233
|
+
- **@fal-ai/client** — AI image generation and editing
|
|
234
|
+
- **Commander.js** — CLI framework
|
|
235
|
+
|
|
236
|
+
## Publish to npm
|
|
237
|
+
|
|
238
|
+
1. Update the version in `package.json` and `index.ts` together.
|
|
239
|
+
2. Make sure you are logged in to npm.
|
|
240
|
+
3. Run `bun publish --dry-run` and inspect the package contents.
|
|
241
|
+
4. Publish with `bun publish --access public`.
|
|
242
|
+
|
|
243
|
+
`picture-it` is currently available as an npm package name.
|
package/hero.png
ADDED
|
Binary file
|