feat(removebg/remove-image-background): update wording
This commit is contained in:
@@ -1,81 +1,82 @@
|
|||||||
import defineAction from '../../../../helpers/define-action';
|
import defineAction from '../../../../helpers/define-action';
|
||||||
|
|
||||||
export default defineAction({
|
export default defineAction({
|
||||||
name: 'Remove Image Background',
|
name: 'Remove image background',
|
||||||
key: 'removeImageBackground',
|
key: 'removeImageBackground',
|
||||||
description:
|
description:
|
||||||
'Removes the background of an image.',
|
'Removes the background of an image.',
|
||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
label: 'Image file',
|
label: 'Image file',
|
||||||
key: 'imageFile',
|
key: 'imageFileB64',
|
||||||
type: 'string' as const,
|
type: 'string' as const,
|
||||||
required: true,
|
required: true,
|
||||||
variables: true,
|
variables: true,
|
||||||
description: 'Provide a JPG or PNG file, up to 12 MB (see remove.bg/supported-images)',
|
description: 'Provide a JPG or PNG file in Base64 format, up to 12 MB (see remove.bg/supported-images)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Size',
|
label: 'Size',
|
||||||
key: 'size',
|
key: 'size',
|
||||||
type: 'dropdown' as const,
|
type: 'dropdown' as const,
|
||||||
required: true,
|
required: true,
|
||||||
value: 'auto',
|
value: 'auto',
|
||||||
options: [
|
options: [
|
||||||
{ label: 'Auto', value: 'auto' },
|
{ label: 'Auto', value: 'auto' },
|
||||||
{ label: 'Preview (up to 0.25 megapixels)', value: 'preview' },
|
{ label: 'Preview (up to 0.25 megapixels)', value: 'preview' },
|
||||||
{ label: 'Full (up to 10 megapixels)', value: 'full' },
|
{ label: 'Full (up to 10 megapixels)', value: 'full' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Add background color',
|
label: 'Background color',
|
||||||
key: 'bgColor',
|
key: 'bgColor',
|
||||||
type: 'string' as const,
|
type: 'string' as const,
|
||||||
description: 'Can be a hex color code (e.g. 81d4fa, fff) or a color name (e.g. green)',
|
description: 'Adds a solid color background. Can be a hex color code (e.g. 81d4fa, fff) or a color name (e.g. green)',
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Add background image URL',
|
label: 'Background image URL',
|
||||||
key: 'bgImage',
|
key: 'bgImageUrl',
|
||||||
type: 'string' as const,
|
type: 'string' as const,
|
||||||
required: false,
|
description: 'Adds a background image from a URL.',
|
||||||
},
|
required: false,
|
||||||
{
|
},
|
||||||
label: 'Output image format',
|
{
|
||||||
key: 'outputFormat',
|
label: 'Output image format',
|
||||||
type: 'dropdown' as const,
|
key: 'outputFormat',
|
||||||
description: 'Note: Use PNG to preserve transparency',
|
type: 'dropdown' as const,
|
||||||
required: true,
|
description: 'Note: Use PNG to preserve transparency',
|
||||||
value: 'auto',
|
required: true,
|
||||||
options: [
|
value: 'auto',
|
||||||
{ label: 'Auto', value: 'auto' },
|
options: [
|
||||||
{ label: 'PNG', value: 'png' },
|
{ label: 'Auto', value: 'auto' },
|
||||||
{ label: 'JPG', value: 'jpg' },
|
{ label: 'PNG', value: 'png' },
|
||||||
{ label: 'ZIP', value: 'zip'}
|
{ label: 'JPG', value: 'jpg' },
|
||||||
]
|
{ label: 'ZIP', value: 'zip' }
|
||||||
}
|
]
|
||||||
],
|
|
||||||
async run($) {
|
|
||||||
const imageFile = $.step.parameters.imageFile as string;
|
|
||||||
const size = $.step.parameters.size as string;
|
|
||||||
const bgColor = $.step.parameters.bgColor as string;
|
|
||||||
const bgImage = $.step.parameters.bgImage as string;
|
|
||||||
const outputFormat = $.step.parameters.outputFormat as string;
|
|
||||||
|
|
||||||
const body = JSON.stringify({
|
|
||||||
image_file_b64: imageFile,
|
|
||||||
size: size,
|
|
||||||
bg_Color: bgColor,
|
|
||||||
bg_image_url: bgImage,
|
|
||||||
format: outputFormat
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = await $.http.post('/removebg', body, {
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
$.setActionItem({ raw: response.data });
|
|
||||||
}
|
}
|
||||||
})
|
],
|
||||||
|
async run($) {
|
||||||
|
const imageFileB64 = $.step.parameters.imageFileB64 as string;
|
||||||
|
const size = $.step.parameters.size as string;
|
||||||
|
const bgColor = $.step.parameters.bgColor as string;
|
||||||
|
const bgImageUrl = $.step.parameters.bgImageUrl as string;
|
||||||
|
const outputFormat = $.step.parameters.outputFormat as string;
|
||||||
|
|
||||||
|
const body = JSON.stringify({
|
||||||
|
image_file_b64: imageFileB64,
|
||||||
|
size: size,
|
||||||
|
bg_color: bgColor,
|
||||||
|
bg_image_url: bgImageUrl,
|
||||||
|
format: outputFormat
|
||||||
|
});
|
||||||
|
|
||||||
|
const response = await $.http.post('/removebg', body, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user