diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aacf46..73b9af3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [21.x] + node-version: [20.x] steps: - uses: actions/checkout@v3 with: diff --git a/package-lock.json b/package-lock.json index b435a19..ce2cdd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "workspace", - "version": "1.5.3", + "version": "1.5.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "workspace", - "version": "1.5.3", + "version": "1.5.4", "workspaces": [ "packages/web", "packages/web-data", diff --git a/package.json b/package.json index 1d2bd0c..db2b31c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.5.3", + "version": "1.5.5", "name": "workspace", "workspaces": [ "packages/web", diff --git a/packages/node-e2e/package.json b/packages/node-e2e/package.json index 751c400..fca8f67 100644 --- a/packages/node-e2e/package.json +++ b/packages/node-e2e/package.json @@ -6,5 +6,5 @@ "@imgly/background-removal-node": "file:../node", "jest": "^29.6.2" }, - "version": "1.5.3" + "version": "1.5.5" } diff --git a/packages/node-examples/package.json b/packages/node-examples/package.json index 187d7e8..85c8f36 100644 --- a/packages/node-examples/package.json +++ b/packages/node-examples/package.json @@ -9,5 +9,5 @@ "@imgly/background-removal-node": "file:../node", "uuidv4": "^6.2.13" }, - "version": "1.5.3" + "version": "1.5.5" } diff --git a/packages/node/package.json b/packages/node/package.json index e64c288..f24f840 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,6 +1,6 @@ { "name": "@imgly/background-removal-node", - "version": "1.5.3", + "version": "1.5.5", "description": "Background Removal in NodeJS", "resources": "@imgly/background-removal-node", "keywords": [ diff --git a/packages/web-data/package.json b/packages/web-data/package.json index e66fc89..410049d 100644 --- a/packages/web-data/package.json +++ b/packages/web-data/package.json @@ -1,6 +1,6 @@ { "name": "@imgly/background-removal-data", - "version": "1.5.3", + "version": "1.5.5", "description": "Background Removal Data", "keywords": [ "background-removal", diff --git a/packages/web-examples/vite-project/package-lock.json b/packages/web-examples/vite-project/package-lock.json index 020cce8..5c871e5 100644 --- a/packages/web-examples/vite-project/package-lock.json +++ b/packages/web-examples/vite-project/package-lock.json @@ -1,12 +1,12 @@ { "name": "vite-project", - "version": "1.5.2", + "version": "1.5.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vite-project", - "version": "1.5.2", + "version": "1.5.5", "dependencies": { "@imgly/background-removal": "file:../../web", "@imgly/background-removal-data": "file:../../web-data", @@ -48,7 +48,7 @@ }, "../../web": { "name": "@imgly/background-removal", - "version": "1.5.2", + "version": "1.5.5", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "@types/lodash-es": "^4.17.12", @@ -75,7 +75,7 @@ }, "../../web-data": { "name": "@imgly/background-removal-data", - "version": "1.5.2", + "version": "1.5.5", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "onnxruntime-web": "~1.18.0" diff --git a/packages/web-examples/vite-project/package.json b/packages/web-examples/vite-project/package.json index 85fa107..99ddb2a 100644 --- a/packages/web-examples/vite-project/package.json +++ b/packages/web-examples/vite-project/package.json @@ -1,7 +1,7 @@ { "name": "vite-project", "private": true, - "version": "1.5.3", + "version": "1.5.5", "type": "module", "scripts": { "start": "npm run dev", diff --git a/packages/web-examples/vite-project/src/App.vue b/packages/web-examples/vite-project/src/App.vue index 911fb16..4ffbeb3 100644 --- a/packages/web-examples/vite-project/src/App.vue +++ b/packages/web-examples/vite-project/src/App.vue @@ -87,9 +87,9 @@ export default { onMounted(async () => { // Optional Preload all assets - // await preload(config).then(() => { - // console.log('Asset preloading succeeded'); - // }); + await preload(config).then(() => { + console.log('Asset preloading succeeded'); + }); if (isRunning.value) { interval = setInterval(() => { seconds.value = calculateSecondsBetweenDates( diff --git a/packages/web/CHANGELOG.md b/packages/web/CHANGELOG.md index eb11564..a2fb480 100644 --- a/packages/web/CHANGELOG.md +++ b/packages/web/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.5.0] ### Added diff --git a/packages/web/README.md b/packages/web/README.md index b9338aa..0107a31 100644 --- a/packages/web/README.md +++ b/packages/web/README.md @@ -1,15 +1,10 @@ # Background Removal in the Browser -### 🚨 We are hiring 🚨 - We are always looking for great people at IMG.LY. If you are working with our background removal library you might be a perfect fit! **Apply now at [IMG.LY Careers](https://img.ly/company/careers/?utm_source=github&utm_medium=readme&utm_campaign=background-removal-js)** -
- -
+<p align="center"> <img src="https://img.ly/showcases/cesdk/web/s/case-thumbnail/background-removal/background-removal-0.png?utm_source=github&utm_medium=project&utm_campaign=background-removal-js" alt="background removal js showcase" /> </p> -Remove backgrounds from images directly in the browser environment with ease and no additional costs or privacy concerns. -Explore an [interactive demo](https://img.ly/showcases/cesdk/web/background-removal/web?utm_source=github&utm_medium=project&utm_campaign=background-removal-js). +Remove backgrounds from images directly in the browser environment with ease and no additional costs or privacy concerns. Explore an [interactive demo](https://img.ly/showcases/cesdk/web/background-removal/web?utm_source=github&utm_medium=project&utm_campaign=background-removal-js). ## News @@ -64,7 +59,7 @@ type Config = { debug: bool; // enable or disable useful console.log outputs device: 'cpu' | 'gpu'; // choose the execution device. gpu will use webgpu if available proxyToWorker: bool; // Whether to proxy the calculations to a web worker. (Default true) - model: 'small' | 'medium'; // The model to use. (Default "medium") + model: 'isnet' | 'isnet_fp16' | 'isnet_quint8'; // The model to use. (Default "isnet_fp16") output: { format: 'image/png' | 'image/jpeg' | 'image/webp'; // The output format. (Default "image/png") quality: number; // The quality. (Default: 0.8) @@ -77,8 +72,8 @@ type Config = { The onnx model is shipped in various sizes and needs. -- small (~40 MB) is the smallest model and is in most cases working fine but sometimes shows some artifacts. It's a quantized model. -- medium (~80MB) is the default model. +- small (\~40 MB) is the smallest model and is in most cases working fine but sometimes shows some artifacts. It's a quantized model. +- medium (\~80MB) is the default model. ### Preloading Assets @@ -91,7 +86,6 @@ const config: Configuration = ...; preload(config).then(() => { console.log("Asset preloading succeeded") }) - ``` ### Download Progress Monitoring @@ -119,8 +113,7 @@ The performance is largely dependent on the feature set available. Most prominen The wasm and onnx neural networks are hosted by IMG.LY by default. For production use, we advise you to host them yourself: -- Download the following package with the package version that matches your `@imgly/background-removal` version from the IMG.LY CDN and decompress it. Note that you need to replace `YOUR_PACKAGE_VERSION` with the actual version of the package you are using. The URL is - `https://staticimgly.com/@imgly/background-removal-data/YOUR_PACKAGE_VERSION/package.tgz`. +- Download the following package with the package version that matches your `@imgly/background-removal` version from the IMG.LY CDN and decompress it. Note that you need to replace `YOUR_PACKAGE_VERSION` with the actual version of the package you are using. The URL is `https://staticimgly.com/@imgly/background-removal-data/YOUR_PACKAGE_VERSION/package.tgz`. - Move the content of the `package/dist` folder to be served by your web server. This often is the `/public` folder. ```typescript @@ -171,11 +164,11 @@ let config: Config = { `@imgly/background-removal` is ideal for developers and projects that require efficient and cost-effective background removal directly in the browser. It caters to a wide range of use cases, including but not limited to: -- _E-commerce applications_ that need to remove backgrounds from product images in real time. +- *E-commerce applications* that need to remove backgrounds from product images in real time. -- _Image editing applications_ that require background removal capabilities for enhancing user experience. +- *Image editing applications* that require background removal capabilities for enhancing user experience. -- _Web-based graphic design tools_ that aim to simplify the creative process with in-browser background removal. +- *Web-based graphic design tools* that aim to simplify the creative process with in-browser background removal. Whether you are a professional developer or a hobbyist, `@imgly/background-removal` empowers you to deliver impressive applications and services with ease. @@ -185,5 +178,4 @@ The software is free for use under the AGPL License. Please contact [support@img ## Authors & Contributors -This library is made by IMG.LY shipping the world's premier SDKs for building creative applications. -Start your trial of the [CreativeEditor SDK](https://img.ly/products/creative-sdk?utm_source=github&utm_medium=project&utm_campaign=background-removal-js), [PhotoEditor SDK](https://img.ly/products/photo-sdk?utm_source=github&utm_medium=project&utm_campaign=background-removal-js) & [VideoEditor SDK](https://img.ly/products/video-sdk?utm_source=github&utm_medium=project&utm_campaign=background-removal-js). +This library is made by IMG.LY shipping the world's premier SDKs for building creative applications. Start your trial of the [CreativeEditor SDK](https://img.ly/products/creative-sdk?utm_source=github&utm_medium=project&utm_campaign=background-removal-js), [PhotoEditor SDK](https://img.ly/products/photo-sdk?utm_source=github&utm_medium=project&utm_campaign=background-removal-js) & [VideoEditor SDK](https://img.ly/products/video-sdk?utm_source=github&utm_medium=project&utm_campaign=background-removal-js). \ No newline at end of file diff --git a/packages/web/changelog/Unreleased/20242403201534-Added_option_to_execute_on_gpu_webgpu_and_cpu_Added.yaml b/packages/web/changelog/1.5.0/20242403201534-Added_option_to_execute_on_gpu_webgpu_and_cpu_Added.yaml similarity index 100% rename from packages/web/changelog/Unreleased/20242403201534-Added_option_to_execute_on_gpu_webgpu_and_cpu_Added.yaml rename to packages/web/changelog/1.5.0/20242403201534-Added_option_to_execute_on_gpu_webgpu_and_cpu_Added.yaml diff --git a/packages/web/changelog/Unreleased/20242503170808-Added_isnet_model_for_webgpu_Added.yaml b/packages/web/changelog/1.5.0/20242503170808-Added_isnet_model_for_webgpu_Added.yaml similarity index 100% rename from packages/web/changelog/Unreleased/20242503170808-Added_isnet_model_for_webgpu_Added.yaml rename to packages/web/changelog/1.5.0/20242503170808-Added_isnet_model_for_webgpu_Added.yaml diff --git a/packages/web/package.json b/packages/web/package.json index c174929..266819b 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@imgly/background-removal", - "version": "1.5.3", + "version": "1.5.5", "description": "Background Removal in the Browser", "keywords": [ "background-removal", diff --git a/packages/web/src/MimeType.ts b/packages/web/src/MimeType.ts new file mode 100644 index 0000000..7ae1e41 --- /dev/null +++ b/packages/web/src/MimeType.ts @@ -0,0 +1,41 @@ +export class MimeType { + type: string = 'application/octet-stream'; + params: Record