@pixerate/editor 0.183.0 → 0.185.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/dist/{chunk-UHMSMUHK.cjs → chunk-C6TRAAG4.cjs} +3 -1
- package/dist/{chunk-Y46OMERN.js → chunk-GYYSPMVU.js} +3 -1
- package/dist/image-editor/controller.d.cts +152 -8
- package/dist/image-editor/controller.d.ts +152 -8
- package/dist/image-editor/index.cjs +1986 -832
- package/dist/image-editor/index.js +1209 -55
- package/dist/image-editor/layers/panel.d.cts +23 -1
- package/dist/image-editor/layers/panel.d.ts +23 -1
- package/dist/image-editor/selection/gesture.d.cts +40 -2
- package/dist/image-editor/selection/gesture.d.ts +40 -2
- package/dist/image-editor/selection/index.d.cts +1 -0
- package/dist/image-editor/selection/index.d.ts +1 -0
- package/dist/image-editor/selection/modify.d.cts +3 -2
- package/dist/image-editor/selection/modify.d.ts +3 -2
- package/dist/image-editor/selection/stroke.d.cts +8 -0
- package/dist/image-editor/selection/stroke.d.ts +8 -0
- package/dist/image-editor/selection/tool-options.d.cts +12 -2
- package/dist/image-editor/selection/tool-options.d.ts +12 -2
- package/dist/image-editor/selection/wand.d.cts +37 -0
- package/dist/image-editor/selection/wand.d.ts +37 -0
- package/dist/image-editor/selection-tools.d.cts +8 -3
- package/dist/image-editor/selection-tools.d.ts +8 -3
- package/dist/image-editor/tools.d.cts +8 -2
- package/dist/image-editor/tools.d.ts +8 -2
- package/dist/image-editor/types.d.cts +2 -0
- package/dist/image-editor/types.d.ts +2 -0
- package/dist/paint-editor/index.cjs +6 -6
- package/dist/paint-editor/index.js +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +12 -21
- package/skills/pixerate-image-editor/references/free-transform.md +22 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +23 -2
|
@@ -74,24 +74,9 @@ Also an optional selection and crop/rotate/flip. See `pixerate-agent-tools` for
|
|
|
74
74
|
|
|
75
75
|
### Free Transform
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
2. **Pick what moves** with `content`: `layer` (all its pixels and a linked mask), `selection`
|
|
81
|
-
(only the selected pixels, committed back into the same layer; the hole they leave is
|
|
82
|
-
transparent and the outline moves with them), `selection-copy` (Layer via Copy, then the copy
|
|
83
|
-
is transformed on a new layer; the original stays) or `auto` (selection when something is
|
|
84
|
-
selected). `channel: "mask"` moves an unlinked mask alone; `transform_selection` moves only
|
|
85
|
-
the outline.
|
|
86
|
-
3. **Choose the tool by the change**: `transform_layer` with `scaleX` / `scaleY` (percent),
|
|
87
|
-
`rotate`, `skewX` / `skewY` (degrees), `dx` / `dy` and a `reference` anchor for scale, rotate
|
|
88
|
-
and skew; `corners` for Distort (each corner free) and Perspective (move two corners
|
|
89
|
-
symmetrically: the top pair in by the same amount narrows the top); `matrix` when you have one;
|
|
90
|
-
`warp_layer` for a preset bend (`style`, `bend`, `horizontal`, `vertical`) or a custom `mesh`;
|
|
91
|
-
`flip_layer` and `rotate_layer_90` for exact flips and quarter turns.
|
|
92
|
-
4. **Transform once.** Every call resamples the pixels, so chained calls soften them: put scale,
|
|
93
|
-
rotation and move into one `transform_layer` call (or one matrix) instead of several.
|
|
94
|
-
5. **Look**: `render_preview`, or `capture_view` at the edges; each call is one undo step.
|
|
77
|
+
`get_transform_frame` first, pick `content` (`layer`, `selection`, `selection-copy`, `auto`), and
|
|
78
|
+
put every change into one `transform_layer` call (each call resamples). Read
|
|
79
|
+
[references/free-transform.md](references/free-transform.md) before transforming.
|
|
95
80
|
|
|
96
81
|
### Smart objects
|
|
97
82
|
|
|
@@ -280,7 +265,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
280
265
|
| Tool | Use it to |
|
|
281
266
|
| --- | --- |
|
|
282
267
|
| `set_adjustments` | Set base controls and existing layer parameters in one undo step: `values` is a map of control id or `layers.<layerId>.<controlId>` path to number; `label` is echoed. Values are clamped to range; returns `applied` and `clamped` (and a note when `tint` is set on a process 1 edit). Unknown ids fail and change nothing. Cannot set curves points, booleans or colours. |
|
|
283
|
-
| `add_adjustment_layer` | Add a layer above the other adjustment layers and below annotations (or directly above `aboveId`, or at the top of group `parentId`): `kind` (curves, levels, hueSaturation, vibrance, colorBalance, blackWhite, photoFilter, invert, posterize, threshold), optional `params` merged with neutral defaults, `opacity` 0..1 (default 1), `blend` (default normal), `name`. Returns the layer (with its new id) and its stack index. The only tool that sets curves points, `colorize`, `preserveLuminosity`, a black and white `tint` or a photo filter `color`. |
|
|
268
|
+
| `add_adjustment_layer` | Add a layer above the other adjustment layers and below annotations (or directly above `aboveId`, or at the top of group `parentId`): `kind` (curves, levels, hueSaturation, vibrance, colorBalance, blackWhite, photoFilter, invert, posterize, threshold), optional `params` merged with neutral defaults, `opacity` 0..1 (default 1), `blend` (default normal), `name`. With a selection the layer is masked by it (`useSelection`, default true; `false` for a global layer; `masked` in the result). Returns the layer (with its new id) and its stack index. The only tool that sets curves points, `colorize`, `preserveLuminosity`, a black and white `tint` or a photo filter `color`. |
|
|
284
269
|
| `select_all` | Select › All. Returns the selection summary (`empty`, `bounds`, `area`, `percent`). |
|
|
285
270
|
| `deselect` | Clear the selection so edits apply to the whole layer. Returns the empty summary. |
|
|
286
271
|
| `invert_selection` | Select › Inverse (soft edges stay soft; with nothing selected, selects all). Returns the summary. |
|
|
@@ -354,7 +339,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
354
339
|
| `copy_smart_object` | Duplicate a smart object above it: `linked: true` shares the contents (edits show in both), `linked: false` (default, New Smart Object via Copy) gives independent contents. Returns the copy and its `contentsId`. |
|
|
355
340
|
| `edit_smart_object_contents` | Open a smart object's contents as their own document (raster contents as one pixel layer, "Layer 0") with their own undo; all tools then act inside them. Returns the size, `layerIds`, `layers` and `editing` (the open path). Always close it. |
|
|
356
341
|
| `close_smart_object_contents` | Close the innermost open contents: `save` true (default) writes them back and re-renders every linked instance (one undo step), false discards. Returns `layerId`, `changed`, `layerIds` and what is still `editing`. |
|
|
357
|
-
| `add_smart_filter` | Add a `develop` (brightness … tint) or `blur` (`radius`) smart filter with its own `blend` and `opacity`, at `index` (default top); kinds may repeat. Returns the `filter` (with id)
|
|
342
|
+
| `add_smart_filter` | Add a `develop` (brightness … tint) or `blur` (`radius`) smart filter with its own `blend` and `opacity`, at `index` (default top); kinds may repeat. With a selection the filter mask is set from it (`useSelection`, default true). Returns the `filter` (with id), the stack and `masked`. |
|
|
358
343
|
| `update_smart_filter` | Change one smart filter's settings, `enabled`, `blend` or `opacity` (`filterId` from `get_smart_object`); kind `psd` filters take only the last three. Returns the filter and the stack. |
|
|
359
344
|
| `remove_smart_filter` | Remove one smart filter (the filter mask goes with the last one). Returns the stack. |
|
|
360
345
|
| `move_smart_filter` | Move a smart filter to `index` (0 = bottom, applied first). Returns the stack. |
|
|
@@ -398,12 +383,18 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
398
383
|
| `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. |
|
|
399
384
|
| `clear_pixels` | Remove the selected pixels (alpha to 0; a transparency-locked layer or a mask gets the background colour). Returns the changed bounds. |
|
|
400
385
|
| `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. |
|
|
401
|
-
| `apply_effect` | Run a provider filter effect on a layer as a smart filter (`target`, `effect`, `values`, `index`, `enabled`, `opacity`); a pixel, shape or type layer becomes a smart object in the same undo step (`converted`). Returns the filter id. |
|
|
386
|
+
| `apply_effect` | Run a provider filter effect on a layer as a smart filter (`target`, `effect`, `values`, `index`, `enabled`, `opacity`); a pixel, shape or type layer becomes a smart object in the same undo step (`converted`). With a selection the filter mask is set from it (`masked`): deselect first to filter the whole layer. Returns the filter id. |
|
|
402
387
|
| `update_effect` | Change an effect smart filter (`values` merged, `null` resets; `enabled`, `opacity`, `index`) or redraw an effect layer (`effect: "generator"`, values only). |
|
|
403
388
|
| `remove_effect` | Remove an effect smart filter, or (`generator`) keep an effect layer's pixels as a plain layer. |
|
|
404
389
|
| `add_effect_layer` | Add a layer drawn by a generator, overlay or title effect at the document's size and bit depth (`values`, `time`, `animate`, `name`, `aboveId` / `belowId`, `opacity`, `blend`). An effect with its own background (`backgroundOpacity` in `describe_effect`) starts with it transparent when there are layers below. Returns the layer id. |
|
|
405
390
|
| `set_effect_layer` | Change an effect layer: swap its `effect` (its defaults plus `values`), pick the still frame (`time`, ms), or make it play in an animation (`animate: { duration }`; `null` for a still frame). The longest animating layer sets the animation's length. |
|
|
406
391
|
| `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. |
|
|
392
|
+
| `stroke_selection` | Edit › Stroke: a band `width` px (≤ 250) `outside` (default), `inside` or `center` on the selection edge, with `color`, `opacity`, `blend`, on a layer's pixels or mask (`channel`). One undo step. Returns the changed `bounds`. |
|
|
393
|
+
| `crop_to_selection` | Set the crop box to the selection's bounds (non-destructive; `reset_crop` undoes it). Returns the `crop`. |
|
|
394
|
+
| `content_aware_fill` | Remove what is selected by synthesising texture from around it on a pixel layer; `output` `new-layer` (keeps the fill separate, recommended) or `current`; `sampleRadius`, `seed` (another seed, another fill). Select with a 2–4 px margin. 8-bit only. Returns `layerId` and `bounds`. |
|
|
395
|
+
| `copy_pixels` | Copy the selected pixels of a layer (or with `merged` the visible image) to the editor clipboard, cropped to the selection with its soft edge. No undo step. Returns `width`, `height`, `x`, `y`. |
|
|
396
|
+
| `cut_pixels` | Copy, then clear the selected pixels (one undo step). Returns the size and position. |
|
|
397
|
+
| `paste_pixels` | Paste the clipboard as a new layer: `mode` `new-layer` (centred on the selection or canvas), `in-place`, `into` (masked by the selection) or `outside` (masked by its inverse). One undo step. Returns `layerId`, `bounds`, `masked`. |
|
|
407
398
|
|
|
408
399
|
### Save and open
|
|
409
400
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Free Transform
|
|
2
|
+
|
|
3
|
+
How to move, scale, rotate, skew, distort and warp layers, selected pixels and masks in the Pixerate image editor. Read it before `transform_layer`, `warp_layer`, `transform_selection`, `flip_layer` or `rotate_layer_90`.
|
|
4
|
+
|
|
5
|
+
1. **Read the frame first**: `get_transform_frame` says what a transform would move (`content`,
|
|
6
|
+
`moved`) and its `frame` (document bounds of the content) with its corners. Every transform
|
|
7
|
+
works on that frame: the numeric fields are percent of it and turn about one of its anchors.
|
|
8
|
+
2. **Pick what moves** with `content`: `layer` (all its pixels and a linked mask), `selection`
|
|
9
|
+
(only the selected pixels, committed back into the same layer; the hole they leave is
|
|
10
|
+
transparent and the outline moves with them), `selection-copy` (Layer via Copy, then the copy
|
|
11
|
+
is transformed on a new layer; the original stays) or `auto` (selection when something is
|
|
12
|
+
selected). `channel: "mask"` moves an unlinked mask alone; `transform_selection` moves only
|
|
13
|
+
the outline.
|
|
14
|
+
3. **Choose the tool by the change**: `transform_layer` with `scaleX` / `scaleY` (percent),
|
|
15
|
+
`rotate`, `skewX` / `skewY` (degrees), `dx` / `dy` and a `reference` anchor for scale, rotate
|
|
16
|
+
and skew; `corners` for Distort (each corner free) and Perspective (move two corners
|
|
17
|
+
symmetrically: the top pair in by the same amount narrows the top); `matrix` when you have one;
|
|
18
|
+
`warp_layer` for a preset bend (`style`, `bend`, `horizontal`, `vertical`) or a custom `mesh`;
|
|
19
|
+
`flip_layer` and `rotate_layer_90` for exact flips and quarter turns.
|
|
20
|
+
4. **Transform once.** Every call resamples the pixels, so chained calls soften them: put scale,
|
|
21
|
+
rotation and move into one `transform_layer` call (or one matrix) instead of several.
|
|
22
|
+
5. **Look**: `render_preview`, or `capture_view` at the edges; each call is one undo step.
|
|
@@ -59,10 +59,15 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
59
59
|
**Check:** `percent` changed by roughly what you intended (a few percent at most for a
|
|
60
60
|
cleanup).
|
|
61
61
|
5. **Output.** Choose by goal:
|
|
62
|
-
- A local adjustment: `
|
|
62
|
+
- A local adjustment: `add_adjustment_layer` while the selection is active (it is masked
|
|
63
|
+
by it), or `apply_selection_as_mask` with `kind`. Filters (`apply_effect`,
|
|
64
|
+
`add_smart_filter`) are also limited to an active selection.
|
|
63
65
|
- A cutout: `layer_via_copy` (the original stays), or `add_layer_mask` `from: "selection"` on
|
|
64
66
|
the layer itself.
|
|
65
|
-
- Painting or fills inside it: keep the selection active and paint
|
|
67
|
+
- Painting or fills inside it: keep the selection active and paint; `stroke_selection` for
|
|
68
|
+
an outline that follows it.
|
|
69
|
+
- Removing what it covers: `content_aware_fill` `output: "new-layer"`.
|
|
70
|
+
- A copy elsewhere: `copy_pixels`, then `paste_pixels` (`into` masks it by a selection).
|
|
66
71
|
Soften with the mask's own `feather` / `density` rather than `modify_selection` `feather`, so
|
|
67
72
|
it stays adjustable.
|
|
68
73
|
6. **Verify.** `render_preview` at 1024 px or more, and `capture_view` on the edge at 2–8×.
|
|
@@ -114,6 +119,14 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
114
119
|
a smart object's filters.
|
|
115
120
|
- **Clip a texture or colour to a layer:** put it directly above and set `clipped: true` with
|
|
116
121
|
`set_layer_properties`; no selection is needed.
|
|
122
|
+
- **Remove an object:** select it with a 2–4 px margin (`modify_selection` `expand`), then
|
|
123
|
+
`content_aware_fill` `output: "new-layer"`; try another `seed` if the fill repeats texture,
|
|
124
|
+
and mask out what is wrong.
|
|
125
|
+
- **Outline a cutout:** `select_layer_transparency` on it, then `stroke_selection`
|
|
126
|
+
`location: "outside"` on a new layer below it.
|
|
127
|
+
- **Crop to a subject:** select it, then `crop_to_selection` (non-destructive).
|
|
128
|
+
- **Put a picture into a shape:** select the shape, `copy_pixels` the picture, then
|
|
129
|
+
`paste_pixels` `mode: "into"`.
|
|
117
130
|
- **Picture inside a frame:** mask the picture with the frame's shape, then
|
|
118
131
|
`set_layer_mask_properties` `linked: false` so the picture moves under a fixed mask; link it
|
|
119
132
|
again afterwards.
|
|
@@ -135,6 +148,9 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
135
148
|
- **Deselected by mistake:** `reselect` brings it back (or `undo_image`).
|
|
136
149
|
- **Empty selection:** `modify_selection`, `refine_selection` and `apply_selection_as_mask` fail
|
|
137
150
|
on it. Select first.
|
|
151
|
+
- **A forgotten selection limits new layers and filters:** `add_adjustment_layer`,
|
|
152
|
+
`apply_effect` and `add_smart_filter` mask themselves by it. `deselect` first for a global
|
|
153
|
+
change, or pass `useSelection: false`.
|
|
138
154
|
- **Hidden selection still applies:** with `set_selection_display` `none`, paint and fills are
|
|
139
155
|
still limited to it. `deselect` before a whole-layer edit.
|
|
140
156
|
- **Wrong coordinates:** use natural image pixels, not preview pixels. On a cropped or rotated
|
|
@@ -167,6 +183,11 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
167
183
|
- `add_layer_mask`, `set_layer_mask_properties`, `apply_layer_mask`, `remove_layer_mask`: layer masks
|
|
168
184
|
- `set_smart_filter_mask`: limit smart filters
|
|
169
185
|
- `layer_via_copy`: lift the selection onto a new layer
|
|
186
|
+
- `stroke_selection`: an outline along the selection edge
|
|
187
|
+
- `crop_to_selection`: crop to the selection's bounds
|
|
188
|
+
- `content_aware_fill`: remove what is selected
|
|
189
|
+
- `copy_pixels`, `cut_pixels`, `paste_pixels`: the editor clipboard
|
|
190
|
+
- `add_adjustment_layer`, `apply_effect`, `add_smart_filter`: masked by an active selection
|
|
170
191
|
- `paint_stroke`: paint on a mask with `channel: "mask"`
|
|
171
192
|
- `undo_image`: take back a step
|
|
172
193
|
- `set_layer_properties`: clipping
|