imgly/background-removal-js

Exposing lower level apis, common package

TorbjornHoltmon opened this issue · 5 comments

Currently, background removal is a simple and intuitive function, which is great.
But I find myself needing to be a little more flexible with how I use it, and I would like to use some of the core functionality.

I noticed that none of the lower level apis are exposed and that some of the code between web and node is duplicated.

Would you be open to a pull request to create a common package that exposes the core of background removal?

I have the same suggestion,it's one time work now.
maybe I want to manual adjust clip mask, this is a common need.

Creating a common package it's a bit tricky due to some dependencies which are different.

I am open for a PR. I tried it for 2-3 hours once but problems kept popping up and it was not worth it.

Also, I would seperate the concerns

  1. Expose low level API
  2. Single common package

What functions would you need. I might add a flag to export the mask instead of the finalized image.

export the mask batter than finalized image, or both

I looked at this for 2-3 hours yesterday.

Before I move forward with a PR I am curious how your publishing works. I can´t see any CI in GitHub actions.
I also need to know how you want the packages to be linked, since you use npm I guess a workspace is necessary.
I use PNPM myself, and I am not too familiar with npm workspaces. But my impression is it works very much the same.
I don't want to spend a lot of time on changing the repo tooling if it is not welcome.

Edit:

I have to say this was a bigger undertaking than I first anticipated.
I wanted the core functionality exposed, and my plan was to dependency inject anything node or web specific.
It ended up messy. I am not the right person to look at this.