@capturebridge/sdk 0.11.3 → 0.11.5
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/CHANGELOG.md +7 -0
- package/ICAO.js +6 -2
- package/IFace.js +5 -2
- package/Version.js +1 -1
- package/examples/icao.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.11.4] - 2024-07-29
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added `background` parameter to `ICAO.check()` and `IFace.icao()` that will
|
|
13
|
+
fill in any part of the cropped image that falls outside the source image.
|
|
14
|
+
|
|
8
15
|
## [0.11.0] - 2024-06-21
|
|
9
16
|
|
|
10
17
|
### Added
|
package/ICAO.js
CHANGED
|
@@ -32,6 +32,9 @@ class ICAO extends Plugin {
|
|
|
32
32
|
* the value will be interpreted as the preferred crop method which will vary
|
|
33
33
|
* by plugin implementation.
|
|
34
34
|
*
|
|
35
|
+
* @param {string} [background=#ffffff] - Hexadecimal color that will fill in
|
|
36
|
+
* any part of the cropped image that falls outside the original source image.
|
|
37
|
+
*
|
|
35
38
|
* @returns {object} Results of the ICAO check, this may vary by plugin
|
|
36
39
|
* implementation.
|
|
37
40
|
*
|
|
@@ -48,7 +51,7 @@ class ICAO extends Plugin {
|
|
|
48
51
|
* console.log(`found ${result.faces_found} faces in the image`)
|
|
49
52
|
* document.body.appendChild(img)
|
|
50
53
|
*/
|
|
51
|
-
async check (image, cropMethod = false) {
|
|
54
|
+
async check (image, cropMethod = false, cropBackground) {
|
|
52
55
|
let imageData
|
|
53
56
|
|
|
54
57
|
// If this is an ImageSource object fetch it's image data
|
|
@@ -63,7 +66,8 @@ class ICAO extends Plugin {
|
|
|
63
66
|
const body = {
|
|
64
67
|
base64: imageData,
|
|
65
68
|
crop: Boolean(cropMethod),
|
|
66
|
-
crop_method: cropMethod || undefined
|
|
69
|
+
crop_method: cropMethod || undefined,
|
|
70
|
+
crop_background: cropBackground || undefined
|
|
67
71
|
}
|
|
68
72
|
const options = {
|
|
69
73
|
method: 'POST',
|
package/IFace.js
CHANGED
|
@@ -131,6 +131,9 @@ export class IFace extends ICAO {
|
|
|
131
131
|
* the value will be interpreted as the preferred crop method which will vary
|
|
132
132
|
* by plugin implementation.
|
|
133
133
|
*
|
|
134
|
+
* @param {string} [background=#ffffff] - Hexadecimal color that will fill in
|
|
135
|
+
* any part of the cropped image that falls outside the original source image.
|
|
136
|
+
*
|
|
134
137
|
* @returns {object} Results of the ICAO check, this may vary by plugin
|
|
135
138
|
* implementation.
|
|
136
139
|
*
|
|
@@ -147,8 +150,8 @@ export class IFace extends ICAO {
|
|
|
147
150
|
* console.log(`found ${result.faces_found} faces in the image`)
|
|
148
151
|
* document.body.appendChild(img)
|
|
149
152
|
*/
|
|
150
|
-
async icao (image, cropMethod = false) {
|
|
151
|
-
return await this.check(image, cropMethod)
|
|
153
|
+
async icao (image, cropMethod = false, cropBackground) {
|
|
154
|
+
return await this.check(image, cropMethod, cropBackground)
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
/**
|
package/Version.js
CHANGED
package/examples/icao.js
CHANGED
|
@@ -7,7 +7,7 @@ import ImageSource from '../../../../sdk/js/ImageSource.js'
|
|
|
7
7
|
const imgSrc = new ImageSource('icao.jpg', 'url')
|
|
8
8
|
|
|
9
9
|
// Perform an ICAO check against the provided Image and return cropped
|
|
10
|
-
const results = await icao.check(imgSrc, true)
|
|
10
|
+
const results = await icao.check(imgSrc, true, '#a5a5a5')
|
|
11
11
|
|
|
12
12
|
// Our stock photo is zoomed in too close, so we pad the canvas to allow for
|
|
13
13
|
// drawing a box around the cropped portion
|