image-js 0.35.1 → 0.35.2

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/index.d.ts CHANGED
@@ -124,7 +124,12 @@ export declare class Image {
124
124
  blackHat(options?: MorphologicalOptions): Image;
125
125
  morphologicalGradient(options?: MorphologicalOptions): Image;
126
126
 
127
- // warpingFourPoints
127
+ warpingFourPoints(
128
+ pts: Array<Array<number>>,
129
+ options?: {
130
+ calculateRatio?: boolean;
131
+ },
132
+ ): Image;
128
133
  crop(options?: CropOptions): Image;
129
134
  cropAlpha(options?: { threshold?: number }): Image;
130
135
  resize(options?: ResizeOptions): Image;
@@ -154,7 +159,7 @@ export declare class Image {
154
159
  getMatrix(options?: { channel?: number }): Matrix;
155
160
  setMatrix(matrix: Matrix, options?: { channel?: number });
156
161
  getPixelsArray(): Array<Array<number>>;
157
- // getIntersection
162
+ getIntersection(mask2: Image): object;
158
163
  getClosestCommonParent(mask: Image): Image;
159
164
  getThreshold(options?: { algorithm?: ThresholdAlgorithm }): number;
160
165
 
@@ -191,9 +196,23 @@ export declare class Image {
191
196
 
192
197
  // cannyEdge
193
198
  convolution(kernel: Kernel, options?: ConvolutionOptions): Image;
194
- // extract
199
+ extract(
200
+ mask: Image,
201
+ options?: {
202
+ position?: Array<number>;
203
+ },
204
+ ): this;
195
205
  // floodFill
196
- // paintLabels
206
+ paintLabels(
207
+ labels: Array<string>,
208
+ positions: Array<Array<number>>,
209
+ options?: {
210
+ color?: Array<number> | string;
211
+ colors?: Array<Array<number>> | Array<string>;
212
+ font?: string | Array<string>;
213
+ rotate?: number | Array<number>;
214
+ },
215
+ ): this;
197
216
  paintMasks(
198
217
  masks: Image | Array<Image>,
199
218
  options?: {
@@ -207,35 +226,87 @@ export declare class Image {
207
226
  labelColor?: string;
208
227
  labelFont?: string;
209
228
  },
210
- ): Image;
211
- // paintPoints
212
- // paintPolyline
213
- // paintPolylines
229
+ ): this;
230
+ paintPoints(
231
+ points: Array<Array<number>>,
232
+ options?: {
233
+ color?: Array<number> | string;
234
+ colors?: Array<Array<number>> | Array<string>;
235
+ randomColors?: boolean;
236
+ distinctColors?: boolean;
237
+ shape?: object;
238
+ },
239
+ ): this;
240
+ paintPolyline(
241
+ points: Array<Array<number>>,
242
+ options?: {
243
+ color?: Array<number>;
244
+ closed?: boolean;
245
+ },
246
+ ): this;
247
+ paintPolylines(
248
+ polylines: Array<Array<Array<number>>>,
249
+ options?: {
250
+ color?: Array<number> | string;
251
+ colors?: Array<Array<number>> | Array<string>;
252
+ randomColors?: boolean;
253
+ distinctColors?: boolean;
254
+ shape?: object;
255
+ },
256
+ ): this;
214
257
  paintPolygon(
215
258
  points: Array<Array<number>>,
216
259
  options?: {
217
260
  color?: Array<number>;
218
261
  filled?: boolean;
219
262
  },
220
- ): Image;
263
+ ): this;
264
+ paintPolygons(
265
+ points: Array<Array<Array<number>>>,
266
+ options?: {
267
+ color?: Array<number> | string;
268
+ colors?: Array<Array<number>> | Array<string>;
269
+ randomColors?: boolean;
270
+ distinctColors?: boolean;
271
+ shape?: object;
272
+ },
273
+ ): this;
221
274
 
222
- // paintPolygons
223
-
224
- // countAlphaPixels
225
- // monotoneChainConvexHull
226
- // minimalBoundingRectangle
227
- // getHistogram
228
- // getHistograms
229
- // getColorHistogram
230
- // getMin
231
- // getMax
232
- // getSum
233
- // getMoment
234
- // getLocalMaxima
235
- // getMedian
236
- // getMean
237
- // getPoints
238
- // getRelativePosition
275
+ countAlphaPixels(options?: { alpha?: number }): number;
276
+ monotoneChainConvexHull(): Array<Array<number>>;
277
+ minimalBoundingRectangle(options?: {
278
+ originalPoints?: Array<Array<number>>;
279
+ }): Array<Array<number>>;
280
+ getHistogram(options?: {
281
+ maxSlots?: number;
282
+ channel?: number;
283
+ useAlpha?: boolean;
284
+ }): Array<number>;
285
+ getHistograms(options?: { maxSlots?: number }): Array<Array<number>>;
286
+ getColorHistogram(options?: {
287
+ useAlpha?: boolean;
288
+ nbSlots?: number;
289
+ }): Array<number>;
290
+ getMin(): Array<number>;
291
+ getMax(): Array<number>;
292
+ getSum(): Array<number>;
293
+ getMoment(xPower: number, yPower: number): number;
294
+ getLocalMaxima(options?: {
295
+ mask?: Image;
296
+ region?: number;
297
+ removeClosePoints?: number;
298
+ invert?: boolean;
299
+ maxEquals?: number;
300
+ }): Array<number>;
301
+ getMedian(): Array<number>;
302
+ getMean(): Array<number>;
303
+ getPoints(): Array<Array<number>>;
304
+ getRelativePosition(
305
+ targetImage: Image,
306
+ options?: {
307
+ defaultFurther?: boolean;
308
+ },
309
+ ): Array<number> | boolean;
239
310
  }
240
311
 
241
312
  export declare class Stack extends Array<Image> {
@@ -10,15 +10,15 @@ var _color = require("../../util/color");
10
10
  var _model = require("../model/model");
11
11
 
12
12
  /**
13
- * Paint a mask or masks on the current image.
13
+ * Paint a label or labels on the current image.
14
14
  * @memberof Image
15
15
  * @instance
16
16
  *
17
- * @param {Array<string>} [labels] - Array of labels to display. Should the the same size as masks.
18
- * @param {Array<Array>} [positions] - Array of labels to display. Should the the same size as masks.
19
- * @param {object} [options]
20
- * @param {number[]|string} [options.color='red'] - Array of 3 elements (R, G, B) or a valid css color.
21
- * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each mask
17
+ * @param {Array<string>} [labels] - Array of labels to display.
18
+ * @param {Array<Array<number>>} [positions] - Array of points [x,y] where the labels should be displayed.
19
+ * @param {object} [options]
20
+ * @param {Array<number>|string} [options.color='red'] - Array of 3 elements (R, G, B) or a valid css color.
21
+ * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each label.
22
22
  * @param {string|Array<string>} [options.font='12px Helvetica'] - Paint the labels in a different CSS style
23
23
  * @param {number|Array<number>} [options.rotate=0] - Rotate each label of a define angle
24
24
  * @return {this} The original painted image
@@ -12,7 +12,7 @@ exports.default = paintPolygon;
12
12
  * @param {Array<Array<number>>} points - Array of [x,y] points
13
13
  * @param {object} [options]
14
14
  * @param {Array<number>} [options.color=[max,0,0]] - Array of 3 elements (R, G, B), default is red.
15
- * @param {Array<number>} [options.filled=false] - If you want the polygon to be filled or not.
15
+ * @param {boolean} [options.filled=false] - If you want the polygon to be filled or not.
16
16
  * @return {this} The original painted image
17
17
  */
18
18
  function paintPolygon(points, options = {}) {
@@ -8,10 +8,10 @@ exports.default = paintPolygons;
8
8
  var _color = require("../../util/color");
9
9
 
10
10
  /**
11
- * Paint an array of polygon on the current image.
11
+ * Paint an array of polygons on the current image.
12
12
  * @memberof Image
13
13
  * @instance
14
- * @param {Array<Array<number>>} polygons - Array of array of [x,y] points
14
+ * @param {Array<Array<Array<number>>>} polygons - Array of array of [x,y] points
15
15
  * @param {object} [options]
16
16
  * @param {Array<number>|string} [options.color] - Array of 3 elements (R, G, B) or a valid css color.
17
17
  * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each mask
@@ -11,7 +11,7 @@ var _color = require("../../util/color");
11
11
  * Paint polylines on the current image.
12
12
  * @memberof Image
13
13
  * @instance
14
- * @param {Array<Array<number>>} polylines - Array of array of [x,y] points
14
+ * @param {Array<Array<Array<number>>>} polylines - Array of array of [x,y] points
15
15
  * @param {object} [options]
16
16
  * @param {Array<number>|string} [options.color] - Array of 3 elements (R, G, B) or a valid css color.
17
17
  * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each mask
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-js",
3
- "version": "0.35.1",
3
+ "version": "0.35.2",
4
4
  "description": "Image processing and manipulation in JavaScript",
5
5
  "keywords": [
6
6
  "image",
@@ -81,7 +81,7 @@
81
81
  "@swiftcarrot/color-fns": "^3.2.0",
82
82
  "blob-util": "^2.0.2",
83
83
  "canny-edge-detector": "^1.0.0",
84
- "fast-bmp": "^1.0.0",
84
+ "fast-bmp": "^2.0.1",
85
85
  "fast-jpeg": "^1.0.1",
86
86
  "fast-list": "^1.0.3",
87
87
  "fast-png": "^6.1.0",
@@ -2,15 +2,15 @@ import { css2array } from '../../util/color';
2
2
  import { RGB } from '../model/model';
3
3
 
4
4
  /**
5
- * Paint a mask or masks on the current image.
5
+ * Paint a label or labels on the current image.
6
6
  * @memberof Image
7
7
  * @instance
8
8
  *
9
- * @param {Array<string>} [labels] - Array of labels to display. Should the the same size as masks.
10
- * @param {Array<Array>} [positions] - Array of labels to display. Should the the same size as masks.
11
- * @param {object} [options]
12
- * @param {number[]|string} [options.color='red'] - Array of 3 elements (R, G, B) or a valid css color.
13
- * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each mask
9
+ * @param {Array<string>} [labels] - Array of labels to display.
10
+ * @param {Array<Array<number>>} [positions] - Array of points [x,y] where the labels should be displayed.
11
+ * @param {object} [options]
12
+ * @param {Array<number>|string} [options.color='red'] - Array of 3 elements (R, G, B) or a valid css color.
13
+ * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each label.
14
14
  * @param {string|Array<string>} [options.font='12px Helvetica'] - Paint the labels in a different CSS style
15
15
  * @param {number|Array<number>} [options.rotate=0] - Rotate each label of a define angle
16
16
  * @return {this} The original painted image
@@ -5,7 +5,7 @@
5
5
  * @param {Array<Array<number>>} points - Array of [x,y] points
6
6
  * @param {object} [options]
7
7
  * @param {Array<number>} [options.color=[max,0,0]] - Array of 3 elements (R, G, B), default is red.
8
- * @param {Array<number>} [options.filled=false] - If you want the polygon to be filled or not.
8
+ * @param {boolean} [options.filled=false] - If you want the polygon to be filled or not.
9
9
  * @return {this} The original painted image
10
10
  */
11
11
  export default function paintPolygon(points, options = {}) {
@@ -1,10 +1,10 @@
1
1
  import { getColors } from '../../util/color';
2
2
 
3
3
  /**
4
- * Paint an array of polygon on the current image.
4
+ * Paint an array of polygons on the current image.
5
5
  * @memberof Image
6
6
  * @instance
7
- * @param {Array<Array<number>>} polygons - Array of array of [x,y] points
7
+ * @param {Array<Array<Array<number>>>} polygons - Array of array of [x,y] points
8
8
  * @param {object} [options]
9
9
  * @param {Array<number>|string} [options.color] - Array of 3 elements (R, G, B) or a valid css color.
10
10
  * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each mask
@@ -4,7 +4,7 @@ import { getColors } from '../../util/color';
4
4
  * Paint polylines on the current image.
5
5
  * @memberof Image
6
6
  * @instance
7
- * @param {Array<Array<number>>} polylines - Array of array of [x,y] points
7
+ * @param {Array<Array<Array<number>>>} polylines - Array of array of [x,y] points
8
8
  * @param {object} [options]
9
9
  * @param {Array<number>|string} [options.color] - Array of 3 elements (R, G, B) or a valid css color.
10
10
  * @param {Array<Array<number>>|Array<string>} [options.colors] - Array of Array of 3 elements (R, G, B) for each color of each mask