@pixerate/editor 0.196.0 → 0.198.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/image-editor/controller.d.cts +35 -0
- package/dist/image-editor/controller.d.ts +35 -0
- package/dist/image-editor/index.cjs +1450 -406
- package/dist/image-editor/index.js +1050 -6
- package/dist/image-editor/selection/gesture.d.cts +8 -0
- package/dist/image-editor/selection/gesture.d.ts +8 -0
- 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/segment/grabcut.d.cts +45 -0
- package/dist/image-editor/selection/segment/grabcut.d.ts +45 -0
- package/dist/image-editor/selection/segment/index.d.cts +4 -0
- package/dist/image-editor/selection/segment/index.d.ts +4 -0
- package/dist/image-editor/selection/segment/maxflow.d.cts +30 -0
- package/dist/image-editor/selection/segment/maxflow.d.ts +30 -0
- package/dist/image-editor/selection/segment/quick.d.cts +28 -0
- package/dist/image-editor/selection/segment/quick.d.ts +28 -0
- package/dist/image-editor/selection/segment/work.d.cts +54 -0
- package/dist/image-editor/selection/segment/work.d.ts +54 -0
- package/dist/image-editor/selection/tool-options.d.cts +11 -1
- package/dist/image-editor/selection/tool-options.d.ts +11 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +7 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState } from './types.cjs';
|
|
2
2
|
import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.cjs';
|
|
3
3
|
import { type MagneticEdgeOptions } from './selection/magnetic.cjs';
|
|
4
|
+
import { type ObjectTarget } from './selection/segment/grabcut.cjs';
|
|
4
5
|
import { RenderOptions } from './renderer.cjs';
|
|
5
6
|
import { type BlendMode } from './blend.cjs';
|
|
6
7
|
import type { ImageHistogram } from './histogram.cjs';
|
|
@@ -140,6 +141,26 @@ export interface SampleOptions {
|
|
|
140
141
|
/** Pixels to use instead of reading the source image (natural size, RGBA). */
|
|
141
142
|
pixels?: PixelBuffer;
|
|
142
143
|
}
|
|
144
|
+
/** Options of {@link ImageEditorController.quickSelect}. */
|
|
145
|
+
export interface QuickSelectCommandOptions {
|
|
146
|
+
/** Brush diameter in natural pixels (default 30). */
|
|
147
|
+
size?: number;
|
|
148
|
+
/** How the strokes combine with the selection (default `replace`: the first replaces, the rest add). */
|
|
149
|
+
mode?: SelectionMode;
|
|
150
|
+
/** Sample every layer (default true) or only the active pixel layer. */
|
|
151
|
+
sampleAllLayers?: boolean;
|
|
152
|
+
/** Smoother, less blocky edges (Photoshop's Auto-Enhance). Default false. */
|
|
153
|
+
enhanceEdge?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/** Options of {@link ImageEditorController.selectObject}. */
|
|
156
|
+
export interface SelectObjectCommandOptions {
|
|
157
|
+
/** How the object combines with the selection (default `replace`). */
|
|
158
|
+
mode?: SelectionMode;
|
|
159
|
+
/** Sample every layer (default true) or only the active pixel layer. */
|
|
160
|
+
sampleAllLayers?: boolean;
|
|
161
|
+
/** Smoother, less blocky edges (Auto-Enhance). Default false. */
|
|
162
|
+
enhanceEdge?: boolean;
|
|
163
|
+
}
|
|
143
164
|
/** A new adjustment layer: its kind plus optional initial values and position. */
|
|
144
165
|
export interface AdjustmentLayerInit<K extends AdjustmentKind = AdjustmentKind> extends AdjustmentLayerUpdate<K> {
|
|
145
166
|
kind: K;
|
|
@@ -1505,6 +1526,20 @@ export declare class ImageEditorController {
|
|
|
1505
1526
|
* snapped outline in natural pixels, for {@link selectPolygon}.
|
|
1506
1527
|
*/
|
|
1507
1528
|
snapToEdges(points: ImagePoint[], options?: MagneticEdgeOptions & SampleOptions): Promise<ImagePoint[]>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Quick Selection: each stroke (the brush's path in natural pixels) grows into the region it is
|
|
1531
|
+
* painted on, out to that region's edges, and is combined with the selection by `mode`; with
|
|
1532
|
+
* `replace`, the first stroke replaces it and the rest add, as the brush does. All strokes are
|
|
1533
|
+
* one undo step. Resolves to the resulting selection.
|
|
1534
|
+
*/
|
|
1535
|
+
quickSelect(strokes: ImagePoint[][], options?: QuickSelectCommandOptions): Promise<SelectionMask | null>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Object Selection: the object inside `target.rect` (natural pixels; what is outside the box is
|
|
1538
|
+
* background) or under `target.point`, found by GrabCut (colour models of object and background
|
|
1539
|
+
* plus a graph cut along edges), combined with the selection by `mode` as one undo step.
|
|
1540
|
+
* Resolves to the resulting selection.
|
|
1541
|
+
*/
|
|
1542
|
+
selectObject(target: ObjectTarget, options?: SelectObjectCommandOptions): Promise<SelectionMask | null>;
|
|
1508
1543
|
/**
|
|
1509
1544
|
* Supplies the pixels the selection tools sample (natural size RGBA), e.g. decoded in a worker
|
|
1510
1545
|
* or in a test; `null` goes back to reading the source image. Without a canvas (Node, workers)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState } from './types.js';
|
|
2
2
|
import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.js';
|
|
3
3
|
import { type MagneticEdgeOptions } from './selection/magnetic.js';
|
|
4
|
+
import { type ObjectTarget } from './selection/segment/grabcut.js';
|
|
4
5
|
import { RenderOptions } from './renderer.js';
|
|
5
6
|
import { type BlendMode } from './blend.js';
|
|
6
7
|
import type { ImageHistogram } from './histogram.js';
|
|
@@ -140,6 +141,26 @@ export interface SampleOptions {
|
|
|
140
141
|
/** Pixels to use instead of reading the source image (natural size, RGBA). */
|
|
141
142
|
pixels?: PixelBuffer;
|
|
142
143
|
}
|
|
144
|
+
/** Options of {@link ImageEditorController.quickSelect}. */
|
|
145
|
+
export interface QuickSelectCommandOptions {
|
|
146
|
+
/** Brush diameter in natural pixels (default 30). */
|
|
147
|
+
size?: number;
|
|
148
|
+
/** How the strokes combine with the selection (default `replace`: the first replaces, the rest add). */
|
|
149
|
+
mode?: SelectionMode;
|
|
150
|
+
/** Sample every layer (default true) or only the active pixel layer. */
|
|
151
|
+
sampleAllLayers?: boolean;
|
|
152
|
+
/** Smoother, less blocky edges (Photoshop's Auto-Enhance). Default false. */
|
|
153
|
+
enhanceEdge?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/** Options of {@link ImageEditorController.selectObject}. */
|
|
156
|
+
export interface SelectObjectCommandOptions {
|
|
157
|
+
/** How the object combines with the selection (default `replace`). */
|
|
158
|
+
mode?: SelectionMode;
|
|
159
|
+
/** Sample every layer (default true) or only the active pixel layer. */
|
|
160
|
+
sampleAllLayers?: boolean;
|
|
161
|
+
/** Smoother, less blocky edges (Auto-Enhance). Default false. */
|
|
162
|
+
enhanceEdge?: boolean;
|
|
163
|
+
}
|
|
143
164
|
/** A new adjustment layer: its kind plus optional initial values and position. */
|
|
144
165
|
export interface AdjustmentLayerInit<K extends AdjustmentKind = AdjustmentKind> extends AdjustmentLayerUpdate<K> {
|
|
145
166
|
kind: K;
|
|
@@ -1505,6 +1526,20 @@ export declare class ImageEditorController {
|
|
|
1505
1526
|
* snapped outline in natural pixels, for {@link selectPolygon}.
|
|
1506
1527
|
*/
|
|
1507
1528
|
snapToEdges(points: ImagePoint[], options?: MagneticEdgeOptions & SampleOptions): Promise<ImagePoint[]>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Quick Selection: each stroke (the brush's path in natural pixels) grows into the region it is
|
|
1531
|
+
* painted on, out to that region's edges, and is combined with the selection by `mode`; with
|
|
1532
|
+
* `replace`, the first stroke replaces it and the rest add, as the brush does. All strokes are
|
|
1533
|
+
* one undo step. Resolves to the resulting selection.
|
|
1534
|
+
*/
|
|
1535
|
+
quickSelect(strokes: ImagePoint[][], options?: QuickSelectCommandOptions): Promise<SelectionMask | null>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Object Selection: the object inside `target.rect` (natural pixels; what is outside the box is
|
|
1538
|
+
* background) or under `target.point`, found by GrabCut (colour models of object and background
|
|
1539
|
+
* plus a graph cut along edges), combined with the selection by `mode` as one undo step.
|
|
1540
|
+
* Resolves to the resulting selection.
|
|
1541
|
+
*/
|
|
1542
|
+
selectObject(target: ObjectTarget, options?: SelectObjectCommandOptions): Promise<SelectionMask | null>;
|
|
1508
1543
|
/**
|
|
1509
1544
|
* Supplies the pixels the selection tools sample (natural size RGBA), e.g. decoded in a worker
|
|
1510
1545
|
* or in a test; `null` goes back to reading the source image. Without a canvas (Node, workers)
|