You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/deepimage/actions/remove-background/remove-background.mjs
+29-14Lines changed: 29 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
+
import{
2
+
BACKGROUND_COLOR_OPTIONS,CROP_TYPE_OPTIONS,
3
+
}from"../../common/constants.mjs";
4
+
import{getUrlOrFile}from"../../common/utils.mjs";
1
5
importdeepimagefrom"../../deepimage.app.mjs";
2
6
3
7
exportdefault{
4
8
key: "deepimage-remove-background",
5
9
name: "Remove Background",
6
-
description: "Removes the background from the provided image using DeepImage. [See the documentation](https://documentation.deep-image.ai/quick-start)",
7
-
version: "0.0.{{ts}}",
10
+
description: "Removes the background from the provided image using DeepImage. [See the documentation](https://documentation.deep-image.ai/image-processing/background-processing)",
11
+
version: "0.0.1",
8
12
type: "action",
9
13
props: {
10
14
deepimage,
@@ -15,23 +19,34 @@ export default {
15
19
],
16
20
},
17
21
backgroundColor: {
18
-
propDefinition: [
19
-
deepimage,
20
-
"backgroundColor",
21
-
],
22
+
type: "string",
23
+
label: "Background Color",
24
+
description: "The background color for the image.",
25
+
options: BACKGROUND_COLOR_OPTIONS,
22
26
},
23
27
cropType: {
24
-
propDefinition: [
25
-
deepimage,
26
-
"cropType",
27
-
],
28
+
type: "string",
29
+
label: "Crop Type",
30
+
description: "The crop type for background removal.",
Copy file name to clipboardExpand all lines: components/deepimage/actions/upscale/upscale.mjs
+17-14Lines changed: 17 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
+
import{getUrlOrFile}from"../../common/utils.mjs";
1
2
importdeepimagefrom"../../deepimage.app.mjs";
2
3
3
4
exportdefault{
4
5
key: "deepimage-upscale",
5
6
name: "Upscale Image",
6
-
description: "Upscales the provided image using Deep Image. [See the documentation](https://documentation.deep-image.ai/)",
7
-
version: "0.0.{{ts}}",
7
+
description: "Upscales the provided image using Deep Image. [See the documentation](https://documentation.deep-image.ai/image-processing/resize-and-padding)",
8
+
version: "0.0.1",
8
9
type: "action",
9
10
props: {
10
11
deepimage,
@@ -15,24 +16,26 @@ export default {
15
16
],
16
17
},
17
18
upscaleMultiplier: {
18
-
propDefinition: [
19
-
deepimage,
20
-
"upscaleMultiplier",
21
-
],
19
+
type: "integer",
20
+
label: "Upscale Multiplier",
21
+
description: "The factor by which to upscale the image in %.",
22
22
},
23
23
generativeUpscale: {
24
-
propDefinition: [
25
-
deepimage,
26
-
"generativeUpscale",
27
-
],
24
+
type: "boolean",
25
+
label: "Generative Upscale",
26
+
description: "Whether to use generative upscale.",
28
27
optional: true,
29
28
},
30
29
},
31
30
asyncrun({ $ }){
32
-
constresponse=awaitthis.deepimage.upscaleImage({
33
-
image: this.image,
34
-
upscaleMultiplier: this.upscaleMultiplier,
35
-
generativeUpscale: this.generativeUpscale,
31
+
constresponse=awaitthis.deepimage.makeRequest({
32
+
$,
33
+
data: {
34
+
url: getUrlOrFile(this.image),
35
+
width: `${this.upscaleMultiplier}%`,
36
+
height: `${this.upscaleMultiplier}%`,
37
+
generative_upscale: this.generativeUpscale,
38
+
},
36
39
});
37
40
38
41
$.export("$summary","Successfully upscaled the image");
description: "The background color for the image, either 'white' or 'transparent'.",
16
-
options: [
17
-
{
18
-
label: "White",
19
-
value: "white",
20
-
},
21
-
{
22
-
label: "Transparent",
23
-
value: "transparent",
24
-
},
25
-
],
26
-
},
27
-
cropType: {
28
-
type: "string",
29
-
label: "Crop Type",
30
-
description: "The crop type for background removal.",
31
-
optional: true,
32
-
options: [
33
-
{
34
-
label: "Center",
35
-
value: "center",
36
-
},
37
-
{
38
-
label: "Item",
39
-
value: "item",
40
-
},
41
-
{
42
-
label: "Content",
43
-
value: "content",
44
-
},
45
-
{
46
-
label: "Cover",
47
-
value: "cover",
48
-
},
49
-
{
50
-
label: "Canvas",
51
-
value: "canvas",
52
-
},
53
-
{
54
-
label: "Bounds",
55
-
value: "bounds",
56
-
},
57
-
],
58
-
},
59
-
upscaleMultiplier: {
60
-
type: "integer",
61
-
label: "Upscale Multiplier",
62
-
description: "The factor by which to upscale the image.",
63
-
},
64
-
generativeUpscale: {
65
-
type: "boolean",
66
-
label: "Generative Upscale",
67
-
description: "Whether to use generative upscale.",
68
-
optional: true,
9
+
label: "Image",
10
+
description: "The URL of the image or the path to the file saved to the `/tmp` directory (e.g. `/tmp/example.jpg`) to process. [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).",
0 commit comments