Forum Discussion
How do I remove the background of a PNG image in Windows 11?
When you need to create transparent images for product photographs, profile pictures, presentations or graphic design, removing the background from PNG images is a common task. For those searching for ‘how to remove a PNG background’, BiRefNet is an AI image segmentation model capable of separating the subject from the background and generating a transparent effect. The project’s official code has been published on GitHub, and the current installation guide is based on Python 3.11 and the packages listed in the project requirements.
How to remove a PNG background
Step 1: Install Git and a compatible Python environment on your computer. Open Command Prompt or a terminal, then download the official project with:
git clone https://github.com/ZhengPeng7/BiRefNet.git
cd BiRefNet
Step 2: The official project recommends creating a Python 3.11 environment and installing its required packages. With Conda installed, run:
conda create -n birefnet python=3.11 -y
conda activate birefnet
pip install -r requirements.txt
The official repository currently recommends PyTorch 2.5 or later for its environment.
Step 3: Obtain the appropriate pretrained model through the model options provided by the project. BiRefNet can also be loaded directly through Transformers with the pretrained
ZhengPeng7/BiRefNet
model, so you do not need to train a model yourself just to perform background removal.
Step 4: If you are using a Gradio-based interface like the one shown, start that interface according to the instructions supplied with that particular UI project. Once it is running, open the local address displayed in the terminal, commonly a 127.0.0.1 address, in your browser.
Step 5: Select the Local Image tab and click the image upload area. Choose the PNG you want to process, or drag the image directly into the upload box.
Step 6: Start the background-removal process and wait for the model to separate the foreground subject from the background. The resulting image will appear in the result panel on the right.
Step 7: Save the processed result as a PNG so that the transparent background is preserved. Examine difficult areas such as hair, clothing edges, and small objects to make sure the segmentation is acceptable.
The model is designed for high-resolution image segmentation and has pretrained options intended for general images and other specialized tasks. Processing speed and memory usage depend on the selected model, input resolution, and hardware; the official documentation notes that 1024 by 1024 inference can require roughly 5.5 GB of GPU memory in its referenced setup.