image-js 1.6.1 → 1.6.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.
@@ -1,15 +1,15 @@
1
1
  /*
2
- * image-js v1.6.1
2
+ * image-js v1.6.2
3
3
  * Image processing and manipulation in JavaScript
4
4
  * https://github.com/image-js/image-js#readme
5
5
  *
6
6
  * Licensed under the MIT license.
7
7
  */
8
8
  (function (global, factory) {
9
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node:assert')) :
10
- typeof define === 'function' && define.amd ? define(['exports', 'node:assert'], factory) :
11
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.IJS = {}, global.assert$1));
12
- })(this, (function (exports, assert$1) { 'use strict';
9
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
10
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
11
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.IJS = {}));
12
+ })(this, (function (exports) { 'use strict';
13
13
 
14
14
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
15
  function getDefaultExportFromCjs (x) {
@@ -14088,7 +14088,7 @@ ${indent}columns: ${matrix.columns}
14088
14088
  contour.push(currentPoint);
14089
14089
  }
14090
14090
  const next = findNextPoint(mask, currentPoint, backtrackPoint);
14091
- assert$1.ok(next, 'Next border point is undefined.');
14091
+ assert(next, 'Next border point is undefined.');
14092
14092
  backtrackPoint = next.prevPoint;
14093
14093
  currentPoint = next.currPoint;
14094
14094
  if (currentPoint.column === startingPoint.column && currentPoint.row === startingPoint.row) {
@@ -23805,7 +23805,7 @@ ${indent}columns: ${matrix.columns}
23805
23805
  },
23806
23806
  maxRansacNbIterations,
23807
23807
  debug = false,
23808
- debugImagePath = `${undefined}/montage.png`
23808
+ debugImagePath
23809
23809
  } = options;
23810
23810
  if (source.colorModel !== ImageColorModel.GREY) {
23811
23811
  source = source.grey();
@@ -23885,6 +23885,9 @@ ${indent}columns: ${matrix.columns}
23885
23885
  }
23886
23886
  // create debug image
23887
23887
  if (debug) {
23888
+ if (!debugImagePath) {
23889
+ throw new RangeError('Debug image file path is not specified.');
23890
+ }
23888
23891
  const montage = new Montage(source, destination, {
23889
23892
  disposition: MontageDisposition.VERTICAL
23890
23893
  });
@@ -25058,10 +25061,27 @@ ${indent}columns: ${matrix.columns}
25058
25061
  }
25059
25062
  return new Image(decodedData.width, decodedData.height, {
25060
25063
  colorModel,
25061
- data: decodedData.data
25064
+ data: decodedData.data,
25065
+ resolution: getBmpResolution(decodedData)
25062
25066
  });
25063
25067
  }
25064
25068
  }
25069
+ /**
25070
+ * Gets image's resolution from its parsed data. BMP stores resolution in
25071
+ * pixels per meter.
25072
+ * @param bmp - Parsed BMP image.
25073
+ * @returns Object with resolution data if it is defined.
25074
+ */
25075
+ function getBmpResolution(bmp) {
25076
+ if (!bmp.xPixelsPerMeter || !bmp.yPixelsPerMeter) {
25077
+ return undefined;
25078
+ }
25079
+ return {
25080
+ x: bmp.xPixelsPerMeter,
25081
+ y: bmp.yPixelsPerMeter,
25082
+ unit: 'meter'
25083
+ };
25084
+ }
25065
25085
 
25066
25086
  const tagsById$2 = {
25067
25087
  0x829a: 'ExposureTime',