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

Background removal / custom handlers #181

Open
1 task done
TorbjornHoltmon opened this issue Oct 22, 2023 · 4 comments
Open
1 task done

Background removal / custom handlers #181

TorbjornHoltmon opened this issue Oct 22, 2023 · 4 comments

Comments

@TorbjornHoltmon
Copy link

Describe the feature

I have tested adding a remove background handler with:
https://github.com/imgly/background-removal-js/tree/main/packages/node

It uses sharp, so it introduces the possibility of dependency duplication.
It also has a Microsoft machine learning library that's quite big.

The POC worked fine, and I think background removal is advantageous.
There were some bugs, some images were made 100% transparent, so it is not flawless.

But I am unsure if IPX should have it.

Adding custom handlers would be nice, so I can add it myself. But it probably would not be used very often.
A lot of effort for something less useful.

What does team unjs think?

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Oct 23, 2023

Thanks for making the issue. It seems a nice idea to support optional custom sharp handlers.

I haven't looked in depth of your code but usage seems a high level removeBackground utility only. Does it also expose a lower level API that accepts sharp instance to apply transform?

@pi0 pi0 added the discussion label Oct 23, 2023
@TorbjornHoltmon
Copy link
Author

It is only a high level API as you said.

I might see if I can expose a lower level API and open a pull request to their library, and then get back to this issue.

Even with the lower API exposed, it still requires the machine learning models that are between ~40MB to ~80MB.
So that's something to consider.

I can open a pull request with a first iteration for you to look at when I get the time.

@pi0
Copy link
Member

pi0 commented Oct 23, 2023

Sure Thanks 🙏 and feel free to also ping me if opened a PR in upstream. I mainly want to make sure we cane make use of any new custom api in ipx when we introduce .

@TorbjornHoltmon
Copy link
Author

TorbjornHoltmon commented Nov 14, 2023

I had a look at the remove background library and attempted to refactor it so that it could be used with IPX. It ended up being too complex for me. I have to forfeit.

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

No branches or pull requests

2 participants