@pixerate/editor 0.92.0 → 0.94.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/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/{chunk-PDCITYBT.cjs → chunk-4F3YDIWW.cjs} +367 -2
- package/dist/chunk-4F3YDIWW.cjs.map +1 -0
- package/dist/chunk-73L6TROJ.cjs +3685 -0
- package/dist/chunk-73L6TROJ.cjs.map +1 -0
- package/dist/chunk-747CGOT2.js +3685 -0
- package/dist/chunk-747CGOT2.js.map +1 -0
- package/dist/{chunk-YLB2WVNA.js → chunk-ISDCJHTO.js} +367 -2
- package/dist/chunk-ISDCJHTO.js.map +1 -0
- package/dist/image-editor/index.cjs +787 -302
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +84 -18
- package/dist/image-editor/index.d.ts +84 -18
- package/dist/image-editor/index.js +560 -75
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +26 -2
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +96 -2
- package/dist/paint/index.d.ts +96 -2
- package/dist/paint/index.js +25 -1
- package/dist/raster/index.cjs +78 -2
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +99 -348
- package/dist/raster/index.d.ts +99 -348
- package/dist/raster/index.js +78 -2
- package/dist/{surface-fJhkmNQn.d.cts → surface-CuBg2c6k.d.cts} +1 -1
- package/dist/{surface-fJhkmNQn.d.ts → surface-CuBg2c6k.d.ts} +1 -1
- package/dist/zlib-BJ6U7LuB.d.cts +795 -0
- package/dist/zlib-BjQkpMFi.d.ts +795 -0
- package/package.json +3 -3
- package/skills/pixerate-image-editor/SKILL.md +63 -4
- package/dist/chunk-H543GD6T.cjs +0 -1696
- package/dist/chunk-H543GD6T.cjs.map +0 -1
- package/dist/chunk-P5TPUNBZ.js +0 -1696
- package/dist/chunk-P5TPUNBZ.js.map +0 -1
- package/dist/chunk-PDCITYBT.cjs.map +0 -1
- package/dist/chunk-YLB2WVNA.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"description": "UI-agnostic rich text and media editing core library",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -186,13 +186,13 @@
|
|
|
186
186
|
"@tiptap/pm": "^2.11.5",
|
|
187
187
|
"@types/dagre": "^0.7.54",
|
|
188
188
|
"@types/markdown-it": "^14.2.0",
|
|
189
|
-
"@types/node": "^
|
|
189
|
+
"@types/node": "^26.6.5",
|
|
190
190
|
"fast-check": "^3.23.2",
|
|
191
191
|
"mermaid": "12.0.0",
|
|
192
192
|
"tiptap-markdown": "^0.8.10",
|
|
193
193
|
"tsup": "^8.4.0",
|
|
194
194
|
"typescript": "^5.7.3",
|
|
195
|
-
"vitest": "^
|
|
195
|
+
"vitest": "^5.0.5"
|
|
196
196
|
},
|
|
197
197
|
"peerDependencies": {
|
|
198
198
|
"@dagrejs/dagre": "^1.1.8",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pixerate-image-editor
|
|
3
|
-
description: How to colour-correct, composite and retouch a photo in the Pixerate image editor through its agent tools - layers (pixel, adjustment, group and annotation layers with masks, clipping, blend modes, opacity and fill; merge, flatten, layer via copy,
|
|
3
|
+
description: How to colour-correct, composite and retouch a photo in the Pixerate image editor through its agent tools - layers (pixel, adjustment, group and annotation layers with masks, clipping, blend modes, opacity and fill; merge, flatten, layer via copy, filters), live layer effects (shadows, glows, bevel and emboss, satin, overlays, strokes), base adjustments (exposure, contrast, white balance, saturation, blur), adjustment layers (curves, levels, hue/saturation, vibrance, color balance, black and white, photo filter, invert, posterize, threshold), selections (wand, color range, grow, shrink, feather, refine edge) and layer masks, crop, rotate and flip, undo, PSD, histogram and PNG previews. Use when asked to edit, grade, correct, brighten, warm up, crop, straighten or mask an image, add a shadow, glow or outline, or open or save a PSD, or when get_adjustments, set_adjustments, add_adjustment_layer, list_layers, add_layer_effect, paint_stroke, select_by_color, import_psd or render_preview are available.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Image editor
|
|
@@ -12,7 +12,8 @@ its mask, opacity and blend mode) and every annotation is its own layer on top.
|
|
|
12
12
|
shows the whole stack. Edits never touch the source pixels. The base controls edit the develop
|
|
13
13
|
filter of the active pixel layer (the Background unless another pixel layer is active); base
|
|
14
14
|
`blur` blurs that layer (or, in documents saved before layers with blur and adjustment layers,
|
|
15
|
-
the output after the layers), and base `opacity` is the output's alpha.
|
|
15
|
+
the output after the layers), and base `opacity` is the output's alpha. Pixel, annotation and
|
|
16
|
+
group layers can carry live effects (shadows, glows, bevels, overlays, strokes). Also an optional
|
|
16
17
|
selection and crop/rotate/flip. See `pixerate-agent-tools` for errors, namespacing and command
|
|
17
18
|
batching.
|
|
18
19
|
|
|
@@ -66,6 +67,25 @@ batching.
|
|
|
66
67
|
5. **Bake only when asked** (`merge_down`, `merge_visible`, `flatten_image`, `apply_layer_mask`):
|
|
67
68
|
they are destructive. `render_preview` with `layerId` shows one layer alone.
|
|
68
69
|
|
|
70
|
+
### Layer effects
|
|
71
|
+
|
|
72
|
+
1. **Effects are live and per layer**: drop and inner shadows, outer and inner glows,
|
|
73
|
+
bevel & emboss, satin, colour / gradient / pattern overlays and strokes go on pixel,
|
|
74
|
+
annotation and group layers (not adjustment layers) and follow the layer's pixels as they
|
|
75
|
+
change. Add them with `add_layer_effect` (`kind` plus only the `settings` that differ from
|
|
76
|
+
Photoshop's defaults), tune them with `update_layer_effect` and read them back with
|
|
77
|
+
`list_layer_effects`. Each call is one undo step and returns the layer's effects.
|
|
78
|
+
2. **Keep the ids**: `add_layer_effect` returns `effectId`; `update_layer_effect` and
|
|
79
|
+
`remove_layer_effect` need it. `list_layers` shows which layers have effects (ids and kinds
|
|
80
|
+
only).
|
|
81
|
+
3. **Light consistently**: shadows and bevels follow the document's global light while
|
|
82
|
+
`useGlobalLight` is true (the default). Change the light for all of them with
|
|
83
|
+
`set_global_light`; give one effect its own `angle` only when it must differ.
|
|
84
|
+
4. **Compare and size as a whole**: `set_layer_effects_enabled` with `enabled: false` hides
|
|
85
|
+
every effect of a layer (each keeps its own `enabled`); `scale` resizes them all (Scale
|
|
86
|
+
Effects), e.g. after resizing a layer's content.
|
|
87
|
+
5. **Look after each change**: `render_preview` (with `layerId` for one layer alone).
|
|
88
|
+
|
|
69
89
|
### Painting
|
|
70
90
|
|
|
71
91
|
1. **Paint on its own layer** (`add_pixel_layer`), never on the Background, unless asked: a
|
|
@@ -79,6 +99,11 @@ batching.
|
|
|
79
99
|
4. **Limit paint with a selection** (select first, then `paint_stroke` / `fill_pixels`), or lock
|
|
80
100
|
transparency (`set_layer_properties` `locks.transparency`) to paint only where the layer
|
|
81
101
|
already has pixels.
|
|
102
|
+
5. **Mix paint colours with `mix_colors`** when the user names paints and amounts ("two parts
|
|
103
|
+
ultramarine to one part yellow", "a tint of red"). It mixes like pigment, so blue and yellow
|
|
104
|
+
make green and white makes a tint, where averaging RGB gives grey or a dull pastel. Pass its
|
|
105
|
+
`mixed` hex as the `color` of `paint_stroke` or `fill_pixels`. Give a strong dark paint a
|
|
106
|
+
`strength` above 1 when a little of it should tint a lot of white.
|
|
82
107
|
|
|
83
108
|
### Photoshop files
|
|
84
109
|
|
|
@@ -129,7 +154,21 @@ batching.
|
|
|
129
154
|
- **Blend modes for tone-only or colour-only changes:** `luminosity` applies a curves or
|
|
130
155
|
levels layer without shifting hue or saturation; `color` applies a tint without changing
|
|
131
156
|
brightness; `soft-light` / `overlay` for gentle contrast.
|
|
157
|
+
- **`pigment` mixes like paint.** On a layer, a fill or a brush, `pigment` mixes the colour into
|
|
158
|
+
what is below as real paint would (Kubelka-Munk): blue into yellow gives green, white gives
|
|
159
|
+
tints, and opacity is the share of new paint (0.5 is half and half). Use it for glazes,
|
|
160
|
+
natural colour mixing and painterly strokes; it is not a Photoshop mode, so keep it off
|
|
161
|
+
layers that must survive a PSD round trip. It costs about ten times a normal blend.
|
|
132
162
|
- **Name layers** (`name`) by intent ("Sky darken", "Warm skin"), so the stack stays readable.
|
|
163
|
+
- **Effects: subtle first.** A drop shadow reads as natural with a small `distance` (2..10 px),
|
|
164
|
+
a `size` a little larger than the distance, `opacity` 0.3..0.6 and the default multiply; a
|
|
165
|
+
hard, dark, far shadow looks pasted on. Glows want `screen` and a light colour; strokes on
|
|
166
|
+
text 1..4 px. Bevels: `depth` 1..2 and `size` a fraction of the shape's thickness.
|
|
167
|
+
- **Outline-only looks** (an outlined title, a glass button): set the layer's `fillOpacity` to
|
|
168
|
+
0 with `set_layer_properties` and keep its effects; fill opacity hides the layer's own pixels,
|
|
169
|
+
layer `opacity` fades the effects too.
|
|
170
|
+
- **Prefer an effect over painted pixels** for shadows, glows, outlines and colour fills of a
|
|
171
|
+
shape: it follows later edits and stays adjustable.
|
|
133
172
|
- **Merge Down only onto an opaque, 100 % lower layer** when the result must look the same:
|
|
134
173
|
the merged layer keeps the lower layer's opacity and blend, so a faded lower layer fades the
|
|
135
174
|
merged content too, and a blend mode on the upper layer stops seeing what was below the lower
|
|
@@ -144,12 +183,13 @@ batching.
|
|
|
144
183
|
| `get_adjustments` | Read the current state: `values` by control id, `process` version (1 or 2), and `layers` bottom to top with id, kind, params, opacity, blend, enabled and mask. Call first, and to find layer ids. |
|
|
145
184
|
| `list_controls` | Get every base control (id, label, section, min, max, step, default, `requiresProcess`), each layer kind's settable controls (plus `opacity`), the blend mode ids and the `layers.<layerId>.<controlId>` path format. Call once per session before writing. |
|
|
146
185
|
| `get_selection` | Read the active selection: `empty`, `bounds` (natural pixels), `area` in pixels, `percent` of the image and a description. Check it after every select or modify step and before masking: a wand that covered 90% of the image is the wrong selection. |
|
|
147
|
-
| `list_layers` | Read the layer stack bottom to top as a tree: id, type (`pixel`, `adjustment`, `group`, `annotation`), name, document `bounds` of pixel layers, visibility, opacity, `fillOpacity`, blend, `clipped`, locks, a `mask` summary, pixel-layer `filters` (the Background's `develop` filter is the base adjustments), adjustment `kind` and `params`, group `children`, and which layer is `active`. Call it to understand a document with more than the Background before changing it; adjustment layer ids work with every adjustment-layer tool. |
|
|
186
|
+
| `list_layers` | Read the layer stack bottom to top as a tree: id, type (`pixel`, `adjustment`, `group`, `annotation`), name, document `bounds` of pixel layers, visibility, opacity, `fillOpacity`, blend, `clipped`, locks, a `mask` summary, an `effects` summary (master switch, scale, effect ids and kinds), pixel-layer `filters` (the Background's `develop` filter is the base adjustments), adjustment `kind` and `params`, group `children`, and which layer is `active`. Call it to understand a document with more than the Background before changing it; adjustment layer ids work with every adjustment-layer tool. |
|
|
187
|
+
| `list_layer_effects` | Read one layer's effects: `enabled` (master switch), `scale` (Scale Effects), `margin` (px they reach beyond the shape), `fromPsd`, and every effect with `id`, `kind`, `label` and all its settings. Also returns the `globalLight`, the `patterns` pattern effects can use and the effect `kinds`. Call before changing effects you did not add. |
|
|
148
188
|
| `get_image_info` | Read the geometry: source `image` size, `crop` box (source pixels, or null), `rotation` degrees, `flipH` / `flipV`, the `output` size after crop and rotation, the layer count and `canUndo` / `canRedo`. Call before cropping or selecting so coordinates are right. |
|
|
149
189
|
| `get_histogram` | Judge exposure numerically: per channel and luminance `mean`, `p1` and `p99` (0..255), and `clipping` percent at pure black and white per channel. Reads the last render, so call `render_preview` first. `bins` (16, 32, 64 or 256) adds the counts. Cheaper than another image for checking a tonal change. |
|
|
150
190
|
| `render_preview` | See the edited image (crop, adjustments, layers, annotations) as a PNG, or with `layerId` one layer alone. `maxSide` 16..2048 px, default 512. Images cost tokens: render after a group of edits, use 512 for overall look and 1024+ to judge clipping, edges and masks. Fails in environments without rendering. |
|
|
151
191
|
| `inspect_psd` | Read a PSD / PSB (`data` base64) without opening it: size, `depth`, `colorMode`, `resolution`, every layer bottom first with `psdKind`, the `type` it would become and `status` (`mapped`, `approximated`, `dropped`) with `notes`, and the import `warnings`. Call before `import_psd`. |
|
|
152
|
-
| `export_psd` | Save the document as an 8-bit RGB PSD (PSB above 30000 px) with layers, groups, adjustment layers and masks. Returns `data` (base64), `size` in bytes, `psb` and `warnings` (crop or rotation not applied, filters and depth masks baked, annotations rasterized or left out). Changes nothing. |
|
|
192
|
+
| `export_psd` | Save the document as an 8-bit RGB PSD (PSB above 30000 px) with layers, groups, adjustment layers and masks. Returns `data` (base64), `size` in bytes, `psb` and `warnings` (crop or rotation not applied, filters and depth masks baked, annotations rasterized or left out, Pigment blends written as Normal). Changes nothing. |
|
|
153
193
|
| `capture_view` | Inspect detail in natural image pixels (the space of `get_selection` and `select_region`, before crop and rotation): `region` `content` (whole image, default), `selection` or `rect`; small regions are enlarged up to 8× with hard pixel edges, so a 64 px rect shows real pixels. `includeOverlays: true` shades unselected pixels and outlines the crop: use it to check a mask's edge before `apply_selection_as_mask`. Returns the `rect` and `scale`. Use `render_preview` for the final framed result. |
|
|
154
194
|
|
|
155
195
|
### Write
|
|
@@ -193,14 +233,28 @@ batching.
|
|
|
193
233
|
| `add_layer_filter` | Add a live `develop` (brightness … tint) or `blur` (`radius`) filter to a pixel layer; one of each kind. Returns the filters with ids. |
|
|
194
234
|
| `update_layer_filter` | Change a filter's values (`filterId` from `list_layers`). Returns the filters. |
|
|
195
235
|
| `remove_layer_filter` | Remove a filter. Returns the remaining filters. |
|
|
236
|
+
| `add_layer_effect` | Add an effect to a pixel, annotation or group layer: `kind` (`drop-shadow`, `inner-shadow`, `outer-glow`, `inner-glow`, `bevel-emboss`, `satin`, `color-overlay`, `gradient-overlay`, `pattern-overlay`, `stroke`) and `settings` that differ from Photoshop's defaults (a setting the kind does not have is refused with its list of settings); optional `index` in the effect list. Returns `effectId` and the layer's effects. |
|
|
237
|
+
| `update_layer_effect` | Change settings of one effect (`effectId`); nested `fill`, `gradient`, `contour` and `texture` objects replace whole, `null` removes an optional `contour`, `glossContour`, `contourElement` or `texture`. The kind cannot change. Returns the effects. |
|
|
238
|
+
| `remove_layer_effect` | Delete one effect. To hide it and keep its settings, set `enabled: false` with `update_layer_effect` instead. Returns the remaining effects. |
|
|
239
|
+
| `set_layer_effects_enabled` | Switch all of a layer's effects on or off (`enabled`) and optionally set Scale Effects (`scale`, 1 = 100 %, multiplies sizes, distances and pattern scales). Returns the effects. |
|
|
240
|
+
| `set_global_light` | Set the document light (`angle`, `altitude` in degrees) that every shadow and bevel with `useGlobalLight` follows. Returns the light. |
|
|
196
241
|
| `paint_stroke` | Paint (`tool` brush) or erase (`tool` eraser) along `points` in document px (optional `pressure` 0..1) on a pixel layer or its mask (`channel`); `color` #rrggbb (on a mask: black hides, white reveals); `brush` `{size, hardness, spacing, angle, roundness, opacity, flow, smoothing, pressureSize, pressureOpacity, blend}`. The selection limits the paint. One undo step per call. Returns the layer, channel, changed `bounds` and dab count. |
|
|
197
242
|
| `fill_pixels` | Fill the selection (or the canvas without one / with `useSelection: false`) on pixels or a mask with `color`, `opacity`, `blend`. Returns the changed bounds. |
|
|
243
|
+
| `mix_colors` | Read-only. Mix 1 to 16 `colors` (`{color: #rrggbb, weight, strength?}`) like paint (Kubelka-Munk over reflectance spectra). Returns `mixed` (#rrggbb), `rgbLerp` (the plain RGB average, for comparison) and the normalised `weights`. Call it before `paint_stroke` / `fill_pixels` to pick a paint colour. |
|
|
198
244
|
| `clear_pixels` | Remove the selected pixels (alpha to 0; a transparency-locked layer or a mask gets the background colour). Returns the changed bounds. |
|
|
199
245
|
| `import_psd` | Open a PSD / PSB (`data` base64, a `data:` URL is fine) as the document, replacing the layers, crop and rotation (one undo step). Returns the new `layers` tree with ids, `layerIds`, size and `warnings` naming the affected layers. Call `inspect_psd` first when losses matter. |
|
|
200
246
|
| `apply_selection_as_mask` | Mask a layer with the current selection: pass `layerId` to mask an existing layer, or `kind` (plus optional `params`) to create a new masked layer in one step. `density` 0..1 and `feather` px soften the mask non-destructively. Returns `layerId`, kind, mask info and the selection summary. |
|
|
201
247
|
|
|
202
248
|
## Pitfalls
|
|
203
249
|
|
|
250
|
+
- Effects need a shape: on an empty layer they draw nothing. They cannot go on adjustment
|
|
251
|
+
layers. A clipped layer's effects stay inside the layer it is clipped to.
|
|
252
|
+
- `bevel-emboss` has no `blend` / `opacity`: it uses `highlightBlend`, `highlightOpacity`,
|
|
253
|
+
`shadowBlend` and `shadowOpacity`. Inner shadows and inner glows use `choke`, not `spread`.
|
|
254
|
+
- Glows paint a colour or a gradient, never a pattern; strokes take all three. Pattern effects
|
|
255
|
+
need a pattern id from `list_layer_effects.patterns`; an unknown id paints nothing.
|
|
256
|
+
- Effect angles are where the light comes *from*: 120° (top left) casts a shadow down and to
|
|
257
|
+
the right. With `useGlobalLight` true an effect's own `angle` is ignored.
|
|
204
258
|
- A layer's `kind` cannot change; to switch kinds add a new layer and remove the old one.
|
|
205
259
|
Curves points, `colorize` and colours are only set when the layer is added, so get them
|
|
206
260
|
right in `add_adjustment_layer` (or replace the layer).
|
|
@@ -211,6 +265,11 @@ batching.
|
|
|
211
265
|
- `paint_stroke`, `fill_pixels` and `clear_pixels` need a visible pixel layer (or a layer with a
|
|
212
266
|
raster mask and `channel: "mask"`); adjustment, group and annotation layers can only be
|
|
213
267
|
painted through their masks. A layer with `locks.pixels` refuses paint.
|
|
268
|
+
- `mix_colors` predicts a mix; it does not paint. To paint the mix, pass `blend: "pigment"` to
|
|
269
|
+
`paint_stroke` (in `brush`) or `fill_pixels`, or set it on a layer.
|
|
270
|
+
- `pigment` has no PSD equivalent: `export_psd` writes those layers as Normal (the merged image
|
|
271
|
+
keeps the look) and says so in `warnings`, naming the layers. `import_psd` never produces it.
|
|
272
|
+
Over transparent pixels there is nothing to mix with, so it lays the colour down as Normal.
|
|
214
273
|
- `export_psd` is in the source frame: a crop or rotation is not in the file (the warnings say
|
|
215
274
|
so). Crop with `set_crop` only for PNG / JPEG output, or flatten the look you need first.
|
|
216
275
|
- PSD opacity, fill and mask density come in as whole percents (Photoshop stores bytes), so a
|