Image Background Removal for Hackers
Real men edit images from the command line
May 2025
There are hundreds (thousands?) of online tools and single-serving apps that claim to offer this feature. Not to mention an entire subculture of Photoshop experts promising to teach the secrets of masking.
And yet... results are still hit-or-miss, often resulting in the annoying "halo" around extracted images.
Thankfully, entire PhDs have been dedicated to this use case, and all of their hard work can be harnessed for free on the command line.
uvx rembg i --model birefnet-general input.png output.png
Which gives state-of-the-art results — all without paying for an Adobe subscription.
There are many models to choose from, but I found BiRefNet to be notably better than the rest in my trials.