@imgly/background-removal
Advanced tools
Comparing version 0.0.1-rc.4 to 0.1.0-rc0
@@ -0,6 +1,6 @@ | ||
export * as utils from './utils'; | ||
export default removeBackground; | ||
import "./bundle"; | ||
import { Imports } from './tensor'; | ||
import { Config } from './types'; | ||
export * as utils from './utils'; | ||
declare function removeBackground(image: ImageData, config?: Config, imports?: Imports): Promise<ImageData>; | ||
export default removeBackground; | ||
declare function removeBackground(image: ImageData | ArrayBuffer | Uint8Array | Blob | URL | string, config?: Config, imports?: Imports): Promise<Blob>; |
import { Imports } from './tensor'; | ||
export type InferenceParams = { | ||
image: ImageData; | ||
resolution: number; | ||
alphaTreshold: number; | ||
output: 'foreground' | 'mask' | 'background'; | ||
}; | ||
export declare function initInferenceSession(model: ArrayBuffer, imports: Imports): Promise<any>; | ||
export declare function runInferenceSession(session: any, params: InferenceParams, imports: Imports): Promise<ImageData>; | ||
export declare function runInferenceSession(session: any, imageData: ImageData, imports: Imports): Promise<ImageData>; |
@@ -5,47 +5,23 @@ import { z } from 'zod'; | ||
modelPath: z.ZodDefault<z.ZodString>; | ||
resolution: z.ZodDefault<z.ZodNumber>; | ||
alphaTreshold: z.ZodDefault<z.ZodNumber>; | ||
debug: z.ZodDefault<z.ZodBoolean>; | ||
output: z.ZodDefault<z.ZodEnum<["mask", "foreground", "background"]>>; | ||
proxyToWorker: z.ZodDefault<z.ZodBoolean>; | ||
useModelCache: z.ZodDefault<z.ZodBoolean>; | ||
useSessionCache: z.ZodDefault<z.ZodBoolean>; | ||
caches: z.ZodDefault<z.ZodObject<{ | ||
models: z.ZodDefault<z.ZodString>; | ||
sessions: z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
models?: string; | ||
sessions?: string; | ||
}, { | ||
models?: string; | ||
sessions?: string; | ||
}>>; | ||
modelCache: z.ZodDefault<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
wasmPath?: string; | ||
modelPath?: string; | ||
resolution?: number; | ||
alphaTreshold?: number; | ||
debug?: boolean; | ||
output?: "mask" | "foreground" | "background"; | ||
proxyToWorker?: boolean; | ||
useModelCache?: boolean; | ||
useSessionCache?: boolean; | ||
caches?: { | ||
models?: string; | ||
sessions?: string; | ||
}; | ||
modelCache?: string; | ||
}, { | ||
wasmPath?: string; | ||
modelPath?: string; | ||
resolution?: number; | ||
alphaTreshold?: number; | ||
debug?: boolean; | ||
output?: "mask" | "foreground" | "background"; | ||
proxyToWorker?: boolean; | ||
useModelCache?: boolean; | ||
useSessionCache?: boolean; | ||
caches?: { | ||
models?: string; | ||
sessions?: string; | ||
}; | ||
modelCache?: string; | ||
}>; |
export declare function downloadURI(uri: string, name: string): void; | ||
export declare function imageDataDownload(imageData: ImageData, name: string): void; | ||
export declare function blobDownload(blob: Blob, name: string): void; | ||
export declare function imageDataToDataUrl(imagedata: ImageData, mime?: string, quality?: number): string; | ||
export declare function imageDecode(blob: Blob): Promise<ImageData>; | ||
export declare function imageEncode(imagedata: ImageData, quality?: number): Promise<Blob>; | ||
export declare function imageBitmapToImageData(imageBitmap: ImageBitmap): ImageData; | ||
export declare function imageDataResize(imageData: ImageData, newWidth: number, newHeight: number): Promise<ImageData>; | ||
export declare function findNonTransparentBoundingBox(imageData: ImageData): { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
}; | ||
export declare function imageDataToFloat32Array(image: ImageData, dims: number[], packed?: boolean): Float32Array; |
{ | ||
"name": "@imgly/background-removal", | ||
"version": "0.0.1-rc.4", | ||
"version": "0.1.0-rc0", | ||
"description": "Background Removal in the browser", | ||
@@ -5,0 +5,0 @@ "main": "./dist/browser.js", |
@@ -1,1 +0,28 @@ | ||
## Background Removal in the Browser and NodeJS | ||
# Background Removal in the Web Browser | ||
## Getting Started | ||
```bash | ||
npm install @imgly/background-removal | ||
``` | ||
or | ||
```bash | ||
yarn add @imgly/background-removal | ||
``` | ||
## Usage | ||
``` | ||
import imgly_bg_remove from `@imgly/background-removal` | ||
let image_src = ...; | ||
imgly_bg_remove(image_src).then((blob: blob) => { | ||
// result is a blob encoded as PNG. | ||
// It can be converted to an | ||
const url = URL.createObjectURL(blob); | ||
}) | ||
``` |
Sorry, the diff of this file is too big to display
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
29
119659856
65
14