Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Parse RemoveBG data results to Inner HTML element (eg. img.src)

I am trying to use the Remove.bg API in a plain JS file, with the goal of passing image URLS as parameters and then outputting the resulting image to an IMG tag within the HTML body.

Unfortunately, the project does not provide documentation for such usage, as the results.data is intended to be used by FileSystem's writeFileSync, which I cannot use as I am running a static website.

Is there per chance, any way to parse the results as described and perhaps set an IMG tag's src to the resulting, background-removed image?

Below is an example code that so far DOES return a response. Thank you in advance for your time!

   function removebackground(){    
            let formData = {
                "image_file_b64": "",
                "image_url": "https://meta.hapeprime.com/7386.png",
                "size": "preview",
                "type": "auto",
                "type_level": "1",
                "format": "auto",
                "roi": "0% 0% 100% 100%",
                "crop": false,
                "crop_margin": "0",
                "scale": "original",
                "position": "original",
                "channels": "rgba",
                "add_shadow": false,
                "semitransparency": true,
                "bg_color": "",
                "bg_image_url": ""
                };

            axios({
            method: 'post',
            url: 'https://api.remove.bg/v1.0/removebg',
            data: formData,
            responseType: 'arraybuffer',
            headers: {
                
                'X-Api-Key': 'API_KEY',
            },
            encoding: null
            })
            .then((response) => {
            if(response.status != 200) return console.error('Error:', response.status, response.statusText);
            console.log(response);
            
            })
            .catch((error) => {
                return console.error('Request failed:', error);
            });
        }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!