Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Open-source background removal in the browser (github.com/imgly)
395 points by buss_jan on June 28, 2023 | hide | past | favorite | 38 comments
@imgly/background-removal is a powerful javascript library that allows seamlessly background removal of images directly in the browser. With its unique features and capabilities, this package offers an innovative and cost-effective solution for background removal tasks without compromising data privacy.



Seems to be on par with the other best background remover I've tried.[0] The first one I've come across that's open source and this good. And it works in the browser! This is great, thanks

[0] https://www.remove.bg/


After looking into there are actually a ton of these websites out there. This is the first actual open source one I've come across that runs in the browser (using WASM)

Non-OS freemium competitors:

- https://www.erase.bg/

- https://www.remove.bg/

- https://pixcleaner.com/

- https://removal.ai/

- https://bgremover.vanceai.com/

- https://www.no-background.coffee/

- https://icons8.com/bgremover


Thank you for this list! Some of them have excellent quality in terms of processing time and output. The reason we shipped this library is that it's now possible to run the background removal on the client, which can save a lot of costs. Especially, if this is not a one off feature, but used frequently by each user / customer. We also believe that client side processing will only get better and even more optimised, so we're happy to kick this race off with the library :)


Another competitor that has AFAIK the best unit pricing is: https://pixian.ai


https://www.photoroom.com is also very good for some things.


yes good for creating product images but it leaves a watermark in the free version.



How can you forget Stability Ai's Clipdrop.co


I didn’t realise that the preview app on Mac’s now has background removal built in. But I’ll also be bookmarking this site!


You can also just right click a file and choose "Remove background" from the Actions menu - on iOS this same behaviour is available just by long-press on a photo almost anywhere and drag the resulting foreground-only image, or alternatively hold and then choose "Copy Subject".

Quite different (arguably better but I guess your use case will determine if it's better or worse) results for some images too, e.g. this image (https://www.southwiltonvet.com/files/HedgehogSouthWiltonVet....). The linked demo removes the hands/arms, macOS retains the hands/arms.

On this image (https://media-cldnry.s-nbcnews.com/image/upload/streams/2014...) the linked demo makes the hands fade away like Greg Kinnear


Yeah, and as is usually the case, it's not Preview in particular doing it. Preview itself does almost nothing, it's just a wrapper around the standard file handling libraries that everything on the platform uses.

So this is just a normal thing you can do in nearly any context that any image is displayed anywhere on macos/ios. Not only no external site required, but not even any particular application required.


This was the first time I heard of img.ly and had a little hobby project I was considering where the tools might be a nice fit... but the terms and cost is extremely opaque. Feels a little surprising given how pleasingly usable and straight-forward this open source software is.

(I _think_ as long as I'm doing a hobby project I could use the img.ly CE.SDK for free indefinitely...? The only restriction is on "production" but what does that mean?)

Probably these products don't match what I'm looking for, but it was all a little hard to ingest. That said, background-removal looks very easy to use and probably does fit my needs, so kudos for that. As someone who loves the ease of prototyping 100% in the browser this is also great!


Unrelated: anything similar for increasing photo resolution? I frequently encounter cases where users upload low resolution images (transferred using Whatsapp or similar) and need to increase the resolution to get something suitable for printing.


There's nothing automated that produces reliably good results with a variety of content currently.

I've tried https://bigjpg.com https://imglarger.com https://vanceai.com/image-enlarger/ https://www.upscale.media https://photoaid.com/en/tools/ai-image-enlarger https://waifu2x.org <- specifically for animated stuff

Given the similarity of the results of some of these, I'd guess they're using the same model with some input parameter tweaks.

Waifu2x is probably the closest to "reliable" if you're looking to enlarge some sort of animated content.


I was checking out one of the suggestions in another comment for background remove and they seem to have this functionality to increase resolution: https://clipdrop.co/apis/docs/super-resolution



I recently came across https://imglarger.com/ which is an AI image enlarger. I haven't used it yet so can't give a review, but they there is a free plan you can try and even their paid tiers seem reasonably priced.


Hmm it works surprisingly well, but it would be practical to have some kind of background area selector to help guide it and a threshold to adjust the removal, since the default setup sometimes messes up ever so slightly in some areas.


The only software I've seen do that is Topazlab's product, which works based on trimapping with some AI edge detection/cleaning thrown in on top of it. Takes some fiddling to get good results, but, easily print quality.


amazing library! I've been using pixian.ai but this is a game changer


Now if someone can just do this for a WASM AI-powered bitmap to vector conversion library, I'll be set


Is there already something like that in the markets? As an API?


I found this one to be really good: https://vectorizer.ai/


Thank you!


That's awesome! I'm bookmarking this for later. This is something I always find myself wanting.


Where does the model come from? Hard to trust the license when we have no idea with what data it has been trained.


Nice one, Remove.bg does the job little better over hairs.


What are the licensing options? Can I use the npm package in a commercial project?


It says it's GPL. So yes you can use it in a commercial project as long as it is also GPL. Also, any license that restricts commercial use is neither Open Source as defined by the OSI, nor is it Free Software as defined by the FSF.


IANAL, but I think it'd be OK to use it as long as you're not transpiling/minifying/bundling it in with your code[1].

Since it's Typescript, you obviously need to transpile to Javascript and host it somewhere you control for security (your own server is fine, just make sure the GPL license text is embedded). This is your GPL-respecting distribution of the software

Then in your webpage's index.html or other markup, include a `<script>` tag that links to it.

I believe this is all you need to be compliant with GPL.

[1]: https://unbiased-coder.com/can-you-use-gpl-in-closed-source/...

edit: much more detail in this answer: https://opensource.stackexchange.com/a/4385/10533

If there's any doubt, it seems like you'd be safe releasing a GPL-ed service worker which your website calls, as the boundary when calling a service worker is definitely enough for it to be deemed communication between two distinct pieces of software. This might be a bit difficult with a library that removes the background from your webcam though


I believe those links are talking about exceptions, and the LGPL.

Any exception would have to be granted by the copyright holder, and the LGPL is a different license which is designed for allowing libraries to be linked into non GPL code.


The project is GPL licensed, if, however, you cannot use GPL licensed software do get in touch with support@img.ly and we'll make the package available to you under a different license.


Amazing tech, congratulations!


how can i modify this if i have product images that have white in them but it keeps getting removed as this think its blended in the background?


Is there a similar tool as an android app?


Great addition!


I need watermark removal version.


You need to pay for art




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: