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

201
Views
How to merge body part image into one

Let's say I have some body part images for user to merge it as nft.

-images
 -eyes
  -blue_eyes.png
  -red_eyes.png
 -body
  -strong_body.png
  -slim_body.png
...

For example:
enter image description here

Users can select different body parts to combine.

If I want to let users to see the preview of the avatar, how should I combine the body part images into one like below, using javascript?

enter image description here

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The only way I know is to use it with HTML and CSS, like this:

In your HTML

<div class="wrappingImage">
  <img class="overlappingImage" src="body.png">
  <img class="overlappingImage" src="eyes.png">
  <img class="overlappingImage" src="mouth.png">
</div>

In your CSS

.overlappingImage {
  position: absolut:
  top: 0;
  left: 0;
}

.wrappingImage {
  position: relative;
}

Than you can add a value (like this: <img value="1">) to your images and place them based on this value in your template after clicking a button - so let body = 0, eyes = 1 and mouth = 1.

Hopefully it helps you out!

about 4 years ago · Juan Pablo Isaza Report

0

You can combine the images using node.js packages merge-images and canvas.

const mergeImages = require('merge-images');
const { Canvas, Image } = require('canvas');
const fs = require('fs');

const run = async () => {
    const outputBase64 = await mergeImages(['./body.png', './eyes.png', './mouth.png'], {
        Canvas: Canvas,
        Image: Image
    });

    fs.writeFileSync(
        './output.png',
        outputBase64.replace(/^data:image\/png;base64,/, ''), // remove the base64 prefix
        {'encoding': 'base64'}
    );
}

run();

Input images:

body eyes mouth

Output image:

output

about 4 years ago · Juan Pablo Isaza Report
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!