The specifics depend on the graphics software you’re using. Some have a background eraser tool. Some don’t have that tool, but you can use the eraser tool to remove the background, which can be tedious. I save as a PNG, as it supports a transparent background better than GIF. JPG doesn’t support transparent backgrounds.
I’m not an expert, but that’s how I do.