banner
andrewji8

Being towards death

Heed not to the tree-rustling and leaf-lashing rain, Why not stroll along, whistle and sing under its rein. Lighter and better suited than horses are straw sandals and a bamboo staff, Who's afraid? A palm-leaf plaited cape provides enough to misty weather in life sustain. A thorny spring breeze sobers up the spirit, I feel a slight chill, The setting sun over the mountain offers greetings still. Looking back over the bleak passage survived, The return in time Shall not be affected by windswept rain or shine.
telegram
twitter
github

3 lines of code, 5 seconds to extract images with AI, no need for Photoshop at all.

Today, I want to introduce this amazing tool that can complete high-precision image cutouts in just 3 lines of code and 5 seconds. You don't even need to know how to code, just click the mouse twice and it's done.

Experience how precise this image cutout tool is:

image

image

image

This tool is called Remove.bg. It is developed based on Python, Ruby, and deep learning technology. It uses powerful AI algorithms to automatically identify the foreground subject and background image, allowing you to complete the cutout in minutes or even seconds.

Website: https://www.remove.bg/zh

First, let's talk about the Python implementation, which is very simple.

After registering on the website and obtaining the API (or you can use mine if you don't want the trouble), install the cutout library with one line of code:

pip install removebg

Next, you only need three lines of code to complete an image cutout:

from removebg import RemoveBg
rmbg = RemoveBg("WPZ2Q4fraseKfAN9PPxxxxxx", "error.log") # Replace the quotes with your API
rmbg.remove_background_from_img_file("C:/Users/sony/Desktop/1.jpg") 

Not only can you cut out a single image, but you can also batch process images (just put the images in a folder):

from removebg import RemoveBg
import os

rmbg = RemoveBg("WPZ2Q4fraseKfAN9PPxxxxxx", "error.log")
path = '%s/picture'%os.getcwd() # Put the images in the program's sibling folder "picture"
for pic in os.listdir(path):
    rmbg.remove_background_from_img_file("%s\%s"%(path,pic))

Isn't it great?

image

The default generated image format and size are standard, and you can process up to 50 photos for free each month. If you want to generate high-definition or even 4K images, or process more photos, you need to pay.

GitHub repository: https://github.com/brilam/remove-bg

image

After cutting out the image, you can immediately change the color or background:

image

In addition to the online version, you can also download the software for local use, which supports Windows, Mac, and Linux platforms.

Another use of image cutouts is to change the background color of ID photos. If you don't know how to use Photoshop and don't want to spend money on retaking photos, you can quickly achieve it using this tool:

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.