imgly / 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
GNU Affero General Public License v3.0
5.49k stars 339 forks source link

Example for Bun #95

Closed Ansh-Rathod closed 4 months ago

Ansh-Rathod commented 5 months ago

Hey, I'm trying this plugin with bun runtime. but i'm having this error dont know it is new or old.


218 | }
219 | async function loadAsUrl(url, config) {
220 |   return URL.createObjectURL(await loadAsBlob(url, config));
221 | }
222 | async function loadAsBlob(key, config) {
223 |   const resourceUrl = new URL("resources.json", config.publicPath);
                          ^
TypeError: "resources.json" cannot be parsed as a URL against <redacted>
      at /Users/anshrathod/Desktop/buns/craftor_server/node_modules/@imgly/background-removal/dist/index.mjs:223:22
      at loadAsBlob (/Users/anshrathod/Desktop/buns/craftor_server/node_modules/@imgly/background-removal/dist/index.mjs:222:26)
      at /Users/anshrathod/Desktop/buns/craftor_server/node_modules/@imgly/background-removal/dist/index.mjs:544:21
      at initInference (/Users/anshrathod/Desktop/buns/craftor_server/node_modules/@imgly/background-removal/dist/index.mjs:539:29)
      at memoized (/Users/anshrathod/Desktop/buns/craftor_server/node_modules/lodash/lodash.js:10620:21)
      at /Users/anshrathod/Desktop/buns/craftor_server/node_modules/@imgly/background-removal/dist/index.mjs:578:36
      at removeBackground (/Users/anshrathod/Desktop/buns/craftor_server/node_modules/@imgly/background-removal/dist/index.mjs:577:32)
      at /Users/anshrathod/Desktop/buns/craftor_server/routes/images/background_remove.ts:11:24
      at /Users/anshrathod/Desktop/buns/craftor_server/routes/images/background_remove.ts:9:22
POST - http://localhost:4444/v1/images/bg-remove failed
jgrisafe commented 5 months ago

I don't think this is bun related, I'm getting the same thing using chrome.

Ansh-Rathod commented 5 months ago

@jgrisafe i thought so! do you know how to make it work?

DanielHauschildt commented 4 months ago

Could you resolve the issue? In which environments does the error come up?

Ansh-Rathod commented 4 months ago

it works with the latest version!