Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it work in Node.js #10

Closed
BjoernRave opened this issue Jul 5, 2023 · 14 comments
Closed

Make it work in Node.js #10

BjoernRave opened this issue Jul 5, 2023 · 14 comments

Comments

@BjoernRave
Copy link

I don't know how complicated this is, but it would be awesome if it would also work in node.js

@liudonghua123
Copy link
Contributor

I have run into the same problems. The browser.{js,mjs} uses some web api like self, window, window.location.href and so on.

It would be nice if it support browser/node/deno environments.

@chrxmvtik
Copy link

I have run into the same problems. The browser.{js,mjs} uses some web api like self, window, window.location.href and so on.

It would be nice if it support browser/node/deno environments.

You can modify webpack config file to get rid of those errors, simply change target to 'node' in umdConfig then build package. It will not be node-only without canvas, etc. But it will work if you want to implement background removal as is in the example package.

@jimmywarting
Copy link

fyi. globalThis should be used instead of window or self

@DanielHauschildt
Copy link
Contributor

DanielHauschildt commented Jul 16, 2023

Making it work on Node.js would require porting parts of the utils.ts. I think most of the functions required like image resize and png/jpeg encode/decode can be achieved by Jimp.

The onnx-runtime also has a Node.js version.

@jimmywarting
Copy link

There are also things such as node-canvas and skia-canvas for NodeJS

@MuLoo
Copy link

MuLoo commented Jul 27, 2023

Looking forward to the version of node.
This tool is great ! ❤️

@maybeyourking
Copy link

Looking forward to the version of node.

@DanielHauschildt
Copy link
Contributor

WIP #26

@AhmedAEB
Copy link

NodeJS version would be amazing 😁

@jwagsters
Copy link

A node version would be soooo helpful.

@djppnur
Copy link

djppnur commented Aug 21, 2023

any update for node js? really excited.

@Crashtor
Copy link

Any update/ETA on this? I'm very interested in this as the IMG.ly PESDK for React Native (or any other framework except iOS / Android) doesn't seem to allow headless rendering or to "programatically edit" an image without going through the editor UI. And since our organisation needs only to utilise the background removal feature, this would be amazing.

@DanielHauschildt
Copy link
Contributor

Fixed by #36

@edwinkcw
Copy link

Thanks for the great work! However, is it published on npm already?

#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests