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

150
Views
saving composited image to directory
await sharp({
        create: {
          width: size.width,
          height: size.height,
          channels: 4,
          background: { r: 255, g: 255, b: 255, alpha: 1 },
        },
      })
        .composite(compositeImages)
        .toFile(Date.now() + '.png')
        .catch((err) => console.log('Error occured, skip'))

As you can see I have this code here. What I try to do is creating a background and then composite 2 or 3 images over it. But .toFile() does not seem to work and I don't know why.

I have also tried to .png() and to .raw() after composite. Also nothing happens. I tried to use fs.writeFile() also nothing happens.

What am I doing wrong here?

Edit: If i remove the .composite() it suddenly writes the file.

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!