@pixerate/editor 0.185.0 → 0.187.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-GYYSPMVU.js → chunk-FW7N64XK.js} +295 -188
- package/dist/{chunk-C6TRAAG4.cjs → chunk-X2KQQZBT.cjs} +355 -248
- package/dist/image-editor/controller.d.cts +89 -0
- package/dist/image-editor/controller.d.ts +89 -0
- package/dist/image-editor/index.cjs +1602 -1030
- package/dist/image-editor/index.js +591 -19
- package/dist/image-editor/layers/model.d.cts +5 -1
- package/dist/image-editor/layers/model.d.ts +5 -1
- package/dist/image-editor/layers/paint-ui.d.cts +2 -1
- package/dist/image-editor/layers/paint-ui.d.ts +2 -1
- package/dist/image-editor/layers/serialize.d.cts +3 -0
- package/dist/image-editor/layers/serialize.d.ts +3 -0
- package/dist/image-editor/psd/channels.d.cts +24 -0
- package/dist/image-editor/psd/channels.d.ts +24 -0
- package/dist/image-editor/psd/export.d.cts +3 -0
- package/dist/image-editor/psd/export.d.ts +3 -0
- package/dist/image-editor/psd/import.d.cts +10 -0
- package/dist/image-editor/psd/import.d.ts +10 -0
- package/dist/image-editor/renderer.d.cts +6 -0
- package/dist/image-editor/renderer.d.ts +6 -0
- package/dist/image-editor/selection/channels.d.cts +52 -0
- package/dist/image-editor/selection/channels.d.ts +52 -0
- package/dist/image-editor/selection/gesture.d.cts +7 -0
- package/dist/image-editor/selection/gesture.d.ts +7 -0
- package/dist/image-editor/selection/index.d.cts +2 -0
- package/dist/image-editor/selection/index.d.ts +2 -0
- package/dist/image-editor/selection/mask-files.d.cts +20 -0
- package/dist/image-editor/selection/mask-files.d.ts +20 -0
- package/dist/image-editor/selection/overlay.d.cts +2 -0
- package/dist/image-editor/selection/overlay.d.ts +2 -0
- package/dist/image-editor/tools.d.cts +3 -1
- package/dist/image-editor/tools.d.ts +3 -1
- package/dist/image-editor/types.d.cts +10 -0
- package/dist/image-editor/types.d.ts +10 -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 -24
- package/skills/pixerate-image-editor/references/painting.md +29 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +20 -2
|
@@ -126,30 +126,9 @@ drawing or editing either.
|
|
|
126
126
|
overall strength and `flow` for gradual build-up within the stroke.
|
|
127
127
|
4. **Limit paint with a selection**, or lock transparency (`set_layer_properties`
|
|
128
128
|
`locks.transparency`) to paint only where the layer already has pixels.
|
|
129
|
-
5. **
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
`mixed` hex as the `color` of `paint_stroke` or `fill_pixels`. Give a strong dark paint a
|
|
133
|
-
`strength` above 1 when a little of it should tint a lot of white.
|
|
134
|
-
6. **Blend and smear with the Mixer Brush** (`paint_stroke` with `tool: "mixer"`) when the
|
|
135
|
-
user wants paint to pick up and drag the colours already on the layer (wet blending, softening
|
|
136
|
-
an edge, pulling one colour into another). `mixer.wet` is how much it picks up (0 paints only
|
|
137
|
-
the loaded colour), `mixer.mix` how far each dab leans from the loaded colour to the picked-up
|
|
138
|
-
one, and `mixer.load` below 1 makes long strokes run dry. Use `mixing: "pigment"` for
|
|
139
|
-
painterly results (blue dragged through yellow goes green); keep `rgb` for retouching, where
|
|
140
|
-
colours should stay between the two you started with. A brush with `blend: "pigment"` mixes
|
|
141
|
-
its one colour into the layer; only the mixer carries picked-up colour along the stroke. A `brush.flow` around 0.3..0.6 keeps
|
|
142
|
-
some of the canvas under each dab and blends more naturally than 1. The stroke samples the
|
|
143
|
-
target layer only, so paint on the layer that holds the colours to blend.
|
|
144
|
-
7. **Keep the mixer stateless unless you need a carried load.** By default each mixer stroke
|
|
145
|
-
loads `color` (or the foreground) and is cleaned afterwards, so every call is independent and
|
|
146
|
-
replays the same. To carry dirty paint from stroke to stroke, pass `mixer.loadEachStroke:
|
|
147
|
-
false` and `cleanEachStroke: false`, start with `load_mixer_brush`, read the brush with
|
|
148
|
-
`get_mixer_brush` when unsure, and reset it with `clean_mixer_brush`.
|
|
149
|
-
8. **Gradient paint** (colour that changes as the stroke goes): `set_paint` with `{ type:
|
|
150
|
-
"gradient", stops, map }`, or `paint_stroke` `paint` for one stroke (brush only). `map.by`
|
|
151
|
-
`distance` (default 300 px, mirrored) for drag-it-out colour, `pressure`, `direction`,
|
|
152
|
-
`across-tip`, `random`; stops may be `"paint"` / `"secondary"` (foreground / background).
|
|
129
|
+
5. **Mixing paint, the Mixer Brush and gradient paint**: `mix_colors` mixes named paints like
|
|
130
|
+
pigment; `paint_stroke` `tool: "mixer"` picks up and smears the layer's colours; gradient paint
|
|
131
|
+
changes colour along a stroke. Read [references/painting.md](references/painting.md) first.
|
|
153
132
|
|
|
154
133
|
### Colour management
|
|
155
134
|
|
|
@@ -241,6 +220,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
241
220
|
| `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. |
|
|
242
221
|
| `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. |
|
|
243
222
|
| `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. |
|
|
223
|
+
| `list_channels` | Read the alpha channels (saved selections): id, name, bounds, percent, overlay and visibility, and whether Quick Mask mode is on. |
|
|
244
224
|
| `select_subject` | Select › Subject (only when the host has a segmentation model): `target` describes what to select ("the dog", "the sky"); an AI model finds the matching objects and selects their outlines, combined by `mode`. `maxSegments` 1 for a single subject. Returns the selection and `found` (label, bounds per object); nothing found leaves the selection unchanged. |
|
|
245
225
|
| `list_layers` | Read the layer stack bottom to top as a tree: id, type (`pixel`, `adjustment`, `group`, `shape`, `annotation`, `smart`; smart objects add their `contents`, `smartFilters` and `filterMask`; shapes a `shape` summary of component ops and kinds and paint types, and `annotation` when migrated from one), 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. |
|
|
246
226
|
| `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. |
|
|
@@ -395,6 +375,14 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
395
375
|
| `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
376
|
| `cut_pixels` | Copy, then clear the selected pixels (one undo step). Returns the size and position. |
|
|
397
377
|
| `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`. |
|
|
378
|
+
| `save_selection` | Save the selection to a new alpha channel (`name`), or into `channelId` by `mode`. Saved with the document and in PSD. Returns the `channel`. |
|
|
379
|
+
| `load_selection_from_channel` | Load an alpha channel as the selection (`channelId`, `invert`, `mode`). Returns the summary. |
|
|
380
|
+
| `set_channel_properties` | Rename a channel or change its overlay `color`, `opacity`, `indicates` (`masked` / `selected`) and `visible`. Returns the `channel`. |
|
|
381
|
+
| `duplicate_channel` | Copy a channel (`name`, default "<name> copy"). Returns the copy. |
|
|
382
|
+
| `delete_channel` | Delete a channel (undoable). Returns the remaining channels. |
|
|
383
|
+
| `export_mask_image` | Read-only. The selection, a channel (`channelId`) or a layer's painted mask (`layerId`) as a greyscale PNG (white = selected), `invert`, `maxSide` (default 1024). Returns the image and its size. |
|
|
384
|
+
| `load_channel_from_image` | Store a mask image (`image` data URL / URL; `channel`, `threshold`, `invert`, `name`) in a new channel without changing the selection. Returns the `channel`. |
|
|
385
|
+
| `set_quick_mask` | Quick Mask mode (`enabled`): paint, fill and retouch tools without `layerId` edit the selection (white selects, black deselects); turn it off before painting layers. Returns the mode. |
|
|
398
386
|
|
|
399
387
|
### Save and open
|
|
400
388
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Painting: mixing paint, the Mixer Brush and gradient paint
|
|
2
|
+
|
|
3
|
+
Read this before `mix_colors`, a `paint_stroke` with `tool: "mixer"`, or gradient paint
|
|
4
|
+
(`set_paint` / `paint_stroke` `paint`).
|
|
5
|
+
|
|
6
|
+
1. **Mix paint colours with `mix_colors`** when the user names paints and amounts ("two parts
|
|
7
|
+
ultramarine to one part yellow", "a tint of red"). It mixes like pigment, so blue and yellow
|
|
8
|
+
make green and white makes a tint, where averaging RGB gives grey or a dull pastel. Pass its
|
|
9
|
+
`mixed` hex as the `color` of `paint_stroke` or `fill_pixels`. Give a strong dark paint a
|
|
10
|
+
`strength` above 1 when a little of it should tint a lot of white.
|
|
11
|
+
2. **Blend and smear with the Mixer Brush** (`paint_stroke` with `tool: "mixer"`) when the
|
|
12
|
+
user wants paint to pick up and drag the colours already on the layer (wet blending, softening
|
|
13
|
+
an edge, pulling one colour into another). `mixer.wet` is how much it picks up (0 paints only
|
|
14
|
+
the loaded colour), `mixer.mix` how far each dab leans from the loaded colour to the picked-up
|
|
15
|
+
one, and `mixer.load` below 1 makes long strokes run dry. Use `mixing: "pigment"` for
|
|
16
|
+
painterly results (blue dragged through yellow goes green); keep `rgb` for retouching, where
|
|
17
|
+
colours should stay between the two you started with. A brush with `blend: "pigment"` mixes
|
|
18
|
+
its one colour into the layer; only the mixer carries picked-up colour along the stroke. A `brush.flow` around 0.3..0.6 keeps
|
|
19
|
+
some of the canvas under each dab and blends more naturally than 1. The stroke samples the
|
|
20
|
+
target layer only, so paint on the layer that holds the colours to blend.
|
|
21
|
+
3. **Keep the mixer stateless unless you need a carried load.** By default each mixer stroke
|
|
22
|
+
loads `color` (or the foreground) and is cleaned afterwards, so every call is independent and
|
|
23
|
+
replays the same. To carry dirty paint from stroke to stroke, pass `mixer.loadEachStroke:
|
|
24
|
+
false` and `cleanEachStroke: false`, start with `load_mixer_brush`, read the brush with
|
|
25
|
+
`get_mixer_brush` when unsure, and reset it with `clean_mixer_brush`.
|
|
26
|
+
4. **Gradient paint** (colour that changes as the stroke goes): `set_paint` with `{ type:
|
|
27
|
+
"gradient", stops, map }`, or `paint_stroke` `paint` for one stroke (brush only). `map.by`
|
|
28
|
+
`distance` (default 300 px, mirrored) for drag-it-out colour, `pressure`, `direction`,
|
|
29
|
+
`across-tip`, `random`; stops may be `"paint"` / `"secondary"` (foreground / background).
|
|
@@ -53,6 +53,9 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
53
53
|
- `grow_selection` (tolerance 10–30) picks up the shades a wand click missed;
|
|
54
54
|
`select_similar` adds the same colours elsewhere in the image.
|
|
55
55
|
- `contract` 1–2 px pulls the edge off a halo.
|
|
56
|
+
- Paint it directly: `set_quick_mask` `enabled: true`, then `paint_stroke` without
|
|
57
|
+
`layerId` (white adds, black removes, a soft brush feathers; `blur_stroke` softens a part
|
|
58
|
+
of the edge), then `set_quick_mask` `enabled: false`.
|
|
56
59
|
- `refine_selection` snaps to real edges: radius 2–4 for hard edges, 8–20 for hair and fur;
|
|
57
60
|
`smartRadius: true` for mixed edges.
|
|
58
61
|
- `shiftEdge` −10..−30 % tightens a refined edge that picked up background.
|
|
@@ -70,7 +73,14 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
70
73
|
- A copy elsewhere: `copy_pixels`, then `paste_pixels` (`into` masks it by a selection).
|
|
71
74
|
Soften with the mask's own `feather` / `density` rather than `modify_selection` `feather`, so
|
|
72
75
|
it stays adjustable.
|
|
73
|
-
6. **
|
|
76
|
+
6. **Store.** `save_selection` with a clear name before you change a selection that took
|
|
77
|
+
work, and whenever it will be needed again (a second adjustment, a later refinement). Load
|
|
78
|
+
it with `load_selection_from_channel`; channels are saved with the document and in PSDs.
|
|
79
|
+
To hand a mask to another tool or service, or to look at it alone, `export_mask_image`
|
|
80
|
+
writes the selection, a channel or a layer mask as a greyscale PNG; a matte that comes
|
|
81
|
+
back goes into a channel with `load_channel_from_image` (or straight to the selection with
|
|
82
|
+
`load_selection_from_image`).
|
|
83
|
+
7. **Verify.** `render_preview` at 1024 px or more, and `capture_view` on the edge at 2–8×.
|
|
74
84
|
**Check:** no fringe of the old background colour, no stair-steps, no visible line where an
|
|
75
85
|
adjustment ends. Fix by loading the mask back (`load_selection_from_mask`), refining, and
|
|
76
86
|
masking again.
|
|
@@ -85,7 +95,7 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
85
95
|
| A colour spread across the image (all the reds, a dress) | `select_color_range` with `samples` (several picks) or a hue `preset`; `localized` to keep one area |
|
|
86
96
|
| Tones (shadows, highlights, a luminosity mask) | `select_color_range` with `preset` `shadows` / `midtones` / `highlights` |
|
|
87
97
|
| Skin for retouching | `select_color_range` `preset: "skinTones"`, then `intersect` with a box around the face |
|
|
88
|
-
| An AI matte or saved mask from the host | `load_selection_from_image` (soft: no `threshold`), then `refine_selection` |
|
|
98
|
+
| An AI matte or saved mask from the host | `load_selection_from_image` (soft: no `threshold`), then `refine_selection`; `load_channel_from_image` to keep it for later |
|
|
89
99
|
| An existing layer mask | `load_selection_from_mask` |
|
|
90
100
|
| A cutout, shape or text already on its own layer | `select_layer_transparency` (exact, soft where the layer is) |
|
|
91
101
|
| A dead pixel row or column | `select_line`, then fill or heal it |
|
|
@@ -151,6 +161,8 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
151
161
|
- **A forgotten selection limits new layers and filters:** `add_adjustment_layer`,
|
|
152
162
|
`apply_effect` and `add_smart_filter` mask themselves by it. `deselect` first for a global
|
|
153
163
|
change, or pass `useSelection: false`.
|
|
164
|
+
- **Quick Mask left on:** while it is on, `paint_stroke` and `fill_pixels` without `layerId`
|
|
165
|
+
edit the selection, not the image. Turn it off when the selection is done.
|
|
154
166
|
- **Hidden selection still applies:** with `set_selection_display` `none`, paint and fills are
|
|
155
167
|
still limited to it. `deselect` before a whole-layer edit.
|
|
156
168
|
- **Wrong coordinates:** use natural image pixels, not preview pixels. On a cropped or rotated
|
|
@@ -168,6 +180,12 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
168
180
|
- `select_layer_transparency`: a layer's own pixels
|
|
169
181
|
- `grow_selection`, `select_similar`: add similar colour, connected or anywhere
|
|
170
182
|
- `reselect`: undo a deselect
|
|
183
|
+
- `save_selection`, `load_selection_from_channel`, `list_channels`: keep selections as alpha channels
|
|
184
|
+
- `set_channel_properties`, `duplicate_channel`, `delete_channel`: manage channels
|
|
185
|
+
- `export_mask_image`: a selection, channel or layer mask as a greyscale PNG
|
|
186
|
+
- `load_channel_from_image`: a mask image into a new channel
|
|
187
|
+
- `set_quick_mask`: paint the selection
|
|
188
|
+
- `fill_pixels`, `blur_stroke`: fill or soften the selection in Quick Mask mode
|
|
171
189
|
- `magic_wand`: similar colour from a seed
|
|
172
190
|
- `select_color_range`: colour samples, hue, tone and skin presets
|
|
173
191
|
- `select_subject`: a subject by description (needs a host model)
|