@digipair/skill-sharp 0.95.5 → 0.95.6
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.cjs.js +18 -2
- package/index.esm.js +17 -3
- package/libs/skill-sharp/src/lib/skill-sharp.d.ts +2 -0
- package/package.json +1 -1
- package/schema.fr.json +31 -16
- package/schema.json +42 -15
package/index.cjs.js
CHANGED
|
@@ -40,9 +40,9 @@ let SharpService = class SharpService {
|
|
|
40
40
|
return buffer.toString('base64');
|
|
41
41
|
}
|
|
42
42
|
async resize(params, _pinsSettingsList, _context) {
|
|
43
|
-
const { content, width, height } = params;
|
|
43
|
+
const { content, width, height, options = {} } = params;
|
|
44
44
|
const { image, mimeType } = await this.loadImage(content);
|
|
45
|
-
image.resize(width, height);
|
|
45
|
+
image.resize(width, height, options);
|
|
46
46
|
return this.toBase64(image, mimeType);
|
|
47
47
|
}
|
|
48
48
|
async rotate(params, _pinsSettingsList, _context) {
|
|
@@ -84,6 +84,18 @@ let SharpService = class SharpService {
|
|
|
84
84
|
image.grayscale();
|
|
85
85
|
return this.toBase64(image, mimeType);
|
|
86
86
|
}
|
|
87
|
+
async linear(params, _pinsSettingsList, _context) {
|
|
88
|
+
const { content, multiplier, offset } = params;
|
|
89
|
+
const { image, mimeType } = await this.loadImage(content);
|
|
90
|
+
image.linear(multiplier, offset);
|
|
91
|
+
return this.toBase64(image, mimeType);
|
|
92
|
+
}
|
|
93
|
+
async threshold(params, _pinsSettingsList, _context) {
|
|
94
|
+
const { content, level = 128, option = {} } = params;
|
|
95
|
+
const { image, mimeType } = await this.loadImage(content);
|
|
96
|
+
image.threshold(level, option);
|
|
97
|
+
return this.toBase64(image, mimeType);
|
|
98
|
+
}
|
|
87
99
|
async negate(params, _pinsSettingsList, _context) {
|
|
88
100
|
const { content } = params;
|
|
89
101
|
const { image, mimeType } = await this.loadImage(content);
|
|
@@ -184,6 +196,8 @@ const extract = (params, pinsSettingsList, context)=>new SharpService().extract(
|
|
|
184
196
|
const flip = (params, pinsSettingsList, context)=>new SharpService().flip(params, pinsSettingsList, context);
|
|
185
197
|
const flop = (params, pinsSettingsList, context)=>new SharpService().flop(params, pinsSettingsList, context);
|
|
186
198
|
const grayscale = (params, pinsSettingsList, context)=>new SharpService().grayscale(params, pinsSettingsList, context);
|
|
199
|
+
const linear = (params, pinsSettingsList, context)=>new SharpService().linear(params, pinsSettingsList, context);
|
|
200
|
+
const threshold = (params, pinsSettingsList, context)=>new SharpService().threshold(params, pinsSettingsList, context);
|
|
187
201
|
const negate = (params, pinsSettingsList, context)=>new SharpService().negate(params, pinsSettingsList, context);
|
|
188
202
|
const tint = (params, pinsSettingsList, context)=>new SharpService().tint(params, pinsSettingsList, context);
|
|
189
203
|
const modulate = (params, pinsSettingsList, context)=>new SharpService().modulate(params, pinsSettingsList, context);
|
|
@@ -204,6 +218,7 @@ exports.flip = flip;
|
|
|
204
218
|
exports.flop = flop;
|
|
205
219
|
exports.grayscale = grayscale;
|
|
206
220
|
exports.jpeg = jpeg;
|
|
221
|
+
exports.linear = linear;
|
|
207
222
|
exports.metadata = metadata;
|
|
208
223
|
exports.modulate = modulate;
|
|
209
224
|
exports.negate = negate;
|
|
@@ -213,6 +228,7 @@ exports.resize = resize;
|
|
|
213
228
|
exports.rotate = rotate;
|
|
214
229
|
exports.sharpen = sharpen;
|
|
215
230
|
exports.stats = stats;
|
|
231
|
+
exports.threshold = threshold;
|
|
216
232
|
exports.tint = tint;
|
|
217
233
|
exports.toFormat = toFormat;
|
|
218
234
|
exports.webp = webp;
|
package/index.esm.js
CHANGED
|
@@ -32,9 +32,9 @@ let SharpService = class SharpService {
|
|
|
32
32
|
return buffer.toString('base64');
|
|
33
33
|
}
|
|
34
34
|
async resize(params, _pinsSettingsList, _context) {
|
|
35
|
-
const { content, width, height } = params;
|
|
35
|
+
const { content, width, height, options = {} } = params;
|
|
36
36
|
const { image, mimeType } = await this.loadImage(content);
|
|
37
|
-
image.resize(width, height);
|
|
37
|
+
image.resize(width, height, options);
|
|
38
38
|
return this.toBase64(image, mimeType);
|
|
39
39
|
}
|
|
40
40
|
async rotate(params, _pinsSettingsList, _context) {
|
|
@@ -76,6 +76,18 @@ let SharpService = class SharpService {
|
|
|
76
76
|
image.grayscale();
|
|
77
77
|
return this.toBase64(image, mimeType);
|
|
78
78
|
}
|
|
79
|
+
async linear(params, _pinsSettingsList, _context) {
|
|
80
|
+
const { content, multiplier, offset } = params;
|
|
81
|
+
const { image, mimeType } = await this.loadImage(content);
|
|
82
|
+
image.linear(multiplier, offset);
|
|
83
|
+
return this.toBase64(image, mimeType);
|
|
84
|
+
}
|
|
85
|
+
async threshold(params, _pinsSettingsList, _context) {
|
|
86
|
+
const { content, level = 128, option = {} } = params;
|
|
87
|
+
const { image, mimeType } = await this.loadImage(content);
|
|
88
|
+
image.threshold(level, option);
|
|
89
|
+
return this.toBase64(image, mimeType);
|
|
90
|
+
}
|
|
79
91
|
async negate(params, _pinsSettingsList, _context) {
|
|
80
92
|
const { content } = params;
|
|
81
93
|
const { image, mimeType } = await this.loadImage(content);
|
|
@@ -176,6 +188,8 @@ const extract = (params, pinsSettingsList, context)=>new SharpService().extract(
|
|
|
176
188
|
const flip = (params, pinsSettingsList, context)=>new SharpService().flip(params, pinsSettingsList, context);
|
|
177
189
|
const flop = (params, pinsSettingsList, context)=>new SharpService().flop(params, pinsSettingsList, context);
|
|
178
190
|
const grayscale = (params, pinsSettingsList, context)=>new SharpService().grayscale(params, pinsSettingsList, context);
|
|
191
|
+
const linear = (params, pinsSettingsList, context)=>new SharpService().linear(params, pinsSettingsList, context);
|
|
192
|
+
const threshold = (params, pinsSettingsList, context)=>new SharpService().threshold(params, pinsSettingsList, context);
|
|
179
193
|
const negate = (params, pinsSettingsList, context)=>new SharpService().negate(params, pinsSettingsList, context);
|
|
180
194
|
const tint = (params, pinsSettingsList, context)=>new SharpService().tint(params, pinsSettingsList, context);
|
|
181
195
|
const modulate = (params, pinsSettingsList, context)=>new SharpService().modulate(params, pinsSettingsList, context);
|
|
@@ -188,4 +202,4 @@ const webp = (params, pinsSettingsList, context)=>new SharpService().webp(params
|
|
|
188
202
|
const avif = (params, pinsSettingsList, context)=>new SharpService().avif(params, pinsSettingsList, context);
|
|
189
203
|
const composite = (params, pinsSettingsList, context)=>new SharpService().composite(params, pinsSettingsList, context);
|
|
190
204
|
|
|
191
|
-
export { avif, blur, composite, extract, flip, flop, grayscale, jpeg, metadata, modulate, negate, png, raw, resize, rotate, sharpen, stats, tint, toFormat, webp };
|
|
205
|
+
export { avif, blur, composite, extract, flip, flop, grayscale, jpeg, linear, metadata, modulate, negate, png, raw, resize, rotate, sharpen, stats, threshold, tint, toFormat, webp };
|
|
@@ -8,6 +8,8 @@ export declare const extract: (params: any, pinsSettingsList: PinsSettings[], co
|
|
|
8
8
|
export declare const flip: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
9
9
|
export declare const flop: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
10
10
|
export declare const grayscale: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
11
|
+
export declare const linear: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
12
|
+
export declare const threshold: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
11
13
|
export declare const negate: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
12
14
|
export declare const tint: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
|
13
15
|
export declare const modulate: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
|
package/package.json
CHANGED
package/schema.fr.json
CHANGED
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"parameters": [
|
|
60
60
|
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
61
61
|
{ "name": "width", "required": true, "schema": { "type": "integer" } },
|
|
62
|
-
{ "name": "height", "required": true, "schema": { "type": "integer" } }
|
|
62
|
+
{ "name": "height", "required": true, "schema": { "type": "integer" } },
|
|
63
|
+
{ "name": "options", "required": false, "schema": { "type": "object" } }
|
|
63
64
|
]
|
|
64
65
|
}
|
|
65
66
|
},
|
|
@@ -93,9 +94,7 @@
|
|
|
93
94
|
"tags": ["service"],
|
|
94
95
|
"summary": "Miroir vertical",
|
|
95
96
|
"description": "Retourne l’image verticalement.",
|
|
96
|
-
"parameters": [
|
|
97
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
98
|
-
]
|
|
97
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
99
98
|
}
|
|
100
99
|
},
|
|
101
100
|
"/flop": {
|
|
@@ -103,9 +102,7 @@
|
|
|
103
102
|
"tags": ["service"],
|
|
104
103
|
"summary": "Miroir horizontal",
|
|
105
104
|
"description": "Retourne l’image horizontalement.",
|
|
106
|
-
"parameters": [
|
|
107
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
108
|
-
]
|
|
105
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
109
106
|
}
|
|
110
107
|
},
|
|
111
108
|
"/grayscale": {
|
|
@@ -113,18 +110,34 @@
|
|
|
113
110
|
"tags": ["service"],
|
|
114
111
|
"summary": "Niveaux de gris",
|
|
115
112
|
"description": "Convertit l’image en niveaux de gris.",
|
|
113
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"/linear": {
|
|
117
|
+
"post": {
|
|
118
|
+
"tags": ["service"],
|
|
119
|
+
"summary": "Linéaire",
|
|
120
|
+
"description": "Applique une transformation linéaire à l’image.",
|
|
116
121
|
"parameters": [
|
|
117
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
122
|
+
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
123
|
+
{ "name": "multiplier", "required": true, "schema": { "type": "number" } },
|
|
124
|
+
{ "name": "offset", "required": true, "schema": { "type": "number" } }
|
|
118
125
|
]
|
|
119
126
|
}
|
|
120
127
|
},
|
|
121
|
-
"/
|
|
128
|
+
"/threshold": {
|
|
122
129
|
"post": {
|
|
123
130
|
"tags": ["service"],
|
|
124
|
-
"summary": "
|
|
125
|
-
"description": "
|
|
131
|
+
"summary": "Seuil",
|
|
132
|
+
"description": "Applique un seuil à l’image pour la convertir en noir et blanc.",
|
|
126
133
|
"parameters": [
|
|
127
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
134
|
+
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
135
|
+
{ "name": "level", "required": false, "schema": { "type": "integer", "default": 128 } },
|
|
136
|
+
{
|
|
137
|
+
"name": "option",
|
|
138
|
+
"required": false,
|
|
139
|
+
"schema": { "type": "object" }
|
|
140
|
+
}
|
|
128
141
|
]
|
|
129
142
|
}
|
|
130
143
|
},
|
|
@@ -170,9 +183,7 @@
|
|
|
170
183
|
"tags": ["service"],
|
|
171
184
|
"summary": "Netteté",
|
|
172
185
|
"description": "Accentue les contours de l’image.",
|
|
173
|
-
"parameters": [
|
|
174
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
175
|
-
]
|
|
186
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
176
187
|
}
|
|
177
188
|
},
|
|
178
189
|
"/toFormat": {
|
|
@@ -209,7 +220,11 @@
|
|
|
209
220
|
"description": "Convertit l’image en format PNG avec niveau de compression personnalisé.",
|
|
210
221
|
"parameters": [
|
|
211
222
|
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
212
|
-
{
|
|
223
|
+
{
|
|
224
|
+
"name": "compressionLevel",
|
|
225
|
+
"required": false,
|
|
226
|
+
"schema": { "type": "integer", "default": 6 }
|
|
227
|
+
}
|
|
213
228
|
]
|
|
214
229
|
}
|
|
215
230
|
},
|
package/schema.json
CHANGED
|
@@ -59,7 +59,12 @@
|
|
|
59
59
|
"parameters": [
|
|
60
60
|
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
61
61
|
{ "name": "width", "required": true, "schema": { "type": "integer" } },
|
|
62
|
-
{ "name": "height", "required": true, "schema": { "type": "integer" } }
|
|
62
|
+
{ "name": "height", "required": true, "schema": { "type": "integer" } },
|
|
63
|
+
{
|
|
64
|
+
"name": "options",
|
|
65
|
+
"required": false,
|
|
66
|
+
"schema": { "type": "object" }
|
|
67
|
+
}
|
|
63
68
|
]
|
|
64
69
|
}
|
|
65
70
|
},
|
|
@@ -93,9 +98,7 @@
|
|
|
93
98
|
"tags": ["service"],
|
|
94
99
|
"summary": "Flip",
|
|
95
100
|
"description": "Flips the image vertically",
|
|
96
|
-
"parameters": [
|
|
97
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
98
|
-
]
|
|
101
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
99
102
|
}
|
|
100
103
|
},
|
|
101
104
|
"/flop": {
|
|
@@ -103,9 +106,7 @@
|
|
|
103
106
|
"tags": ["service"],
|
|
104
107
|
"summary": "Flop",
|
|
105
108
|
"description": "Flips the image horizontally",
|
|
106
|
-
"parameters": [
|
|
107
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
108
|
-
]
|
|
109
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
109
110
|
}
|
|
110
111
|
},
|
|
111
112
|
"/grayscale": {
|
|
@@ -113,8 +114,34 @@
|
|
|
113
114
|
"tags": ["service"],
|
|
114
115
|
"summary": "Grayscale",
|
|
115
116
|
"description": "Converts the image to grayscale",
|
|
117
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"/linear": {
|
|
121
|
+
"post": {
|
|
122
|
+
"tags": ["service"],
|
|
123
|
+
"summary": "Linear",
|
|
124
|
+
"description": "Applies a linear transformation to the image",
|
|
116
125
|
"parameters": [
|
|
117
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
126
|
+
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
127
|
+
{ "name": "multiplier", "required": true, "schema": { "type": "number" } },
|
|
128
|
+
{ "name": "offset", "required": true, "schema": { "type": "number" } }
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"/threshold": {
|
|
133
|
+
"post": {
|
|
134
|
+
"tags": ["service"],
|
|
135
|
+
"summary": "Threshold",
|
|
136
|
+
"description": "Applies a threshold to the image to convert it to black and white.",
|
|
137
|
+
"parameters": [
|
|
138
|
+
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
139
|
+
{ "name": "level", "required": false, "schema": { "type": "integer", "default": 128 } },
|
|
140
|
+
{
|
|
141
|
+
"name": "option",
|
|
142
|
+
"required": false,
|
|
143
|
+
"schema": { "type": "object" }
|
|
144
|
+
}
|
|
118
145
|
]
|
|
119
146
|
}
|
|
120
147
|
},
|
|
@@ -123,9 +150,7 @@
|
|
|
123
150
|
"tags": ["service"],
|
|
124
151
|
"summary": "Negate",
|
|
125
152
|
"description": "Inverts the image colors",
|
|
126
|
-
"parameters": [
|
|
127
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
128
|
-
]
|
|
153
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
129
154
|
}
|
|
130
155
|
},
|
|
131
156
|
"/tint": {
|
|
@@ -170,9 +195,7 @@
|
|
|
170
195
|
"tags": ["service"],
|
|
171
196
|
"summary": "Sharpen",
|
|
172
197
|
"description": "Sharpens the image",
|
|
173
|
-
"parameters": [
|
|
174
|
-
{ "name": "content", "required": true, "schema": { "type": "string" } }
|
|
175
|
-
]
|
|
198
|
+
"parameters": [{ "name": "content", "required": true, "schema": { "type": "string" } }]
|
|
176
199
|
}
|
|
177
200
|
},
|
|
178
201
|
"/toFormat": {
|
|
@@ -209,7 +232,11 @@
|
|
|
209
232
|
"description": "Exports the image as PNG",
|
|
210
233
|
"parameters": [
|
|
211
234
|
{ "name": "content", "required": true, "schema": { "type": "string" } },
|
|
212
|
-
{
|
|
235
|
+
{
|
|
236
|
+
"name": "compressionLevel",
|
|
237
|
+
"required": false,
|
|
238
|
+
"schema": { "type": "integer", "default": 6 }
|
|
239
|
+
}
|
|
213
240
|
]
|
|
214
241
|
}
|
|
215
242
|
},
|