Closed gtrabanco closed 1 year ago
Same here
Do you know any free alternative for the package? I know about remove.bg, but it's pricing is too high for our customer
UPD:
Node version: v20.1.0
Also getting an error Could not find a declaration file for module '@imgly/background-removal-node'
when import removeBackground
Same here
Do you know any free alternative for the package? I know about remove.bg, but it's pricing is too high for our customer
UPD: Node version:
v20.1.0
Also getting an error
Could not find a declaration file for module '@imgly/background-removal-node'
when importremoveBackground
No I do not know. You can use a onnyx model and do your own implementation.
Finally I got the problem, buffer (?) need to be resolved before writing to file.
Here is the right nodejs code (as esm):
import { removeBackground } from "@imgly/background-removal-node";
const url =
"https://balonmano.isquad.es/images/afiliacion_clubs/2898/square_35723432687275366a39.jpg";
try {
const imgBg = await removeBackground(url, {
model: "medium", // default but I want to be explicity with this
progress: (key, current, total) => {
console.log(`Downloading ${key}: ${current} of ${total}`);
},
});
sharp(await imgBg.arrayBuffer()).toFile("output.png");
} catch (error) {
console.log(error);
}
Description
I was running a test of new node version and I could not run it. With Bun there are some issues with onnyx so I tried with node 18.
Error
(I replaced in the output error my home for
$HOME
var or~
)Installation
index.mjs
I tried this after trying directly with url with this code with same result:
Other
I am not sure if this is an issue or help wanted because I am doing something wrong.
My arch (
uname -mprs
):Darwin 21.6.0 x86_64 i386
Node version:v18.17.1
I am using fnm which should not be relevant but just to give full details.