question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Error: Input file is missing]

See original GitHub issue

What are you trying to achieve?

Overlap two images but it tells [Error: Input file is missing].

Have you searched for similar questions?

Yes

Are you able to provide a minimal, standalone code sample that demonstrates this question?

const sharp = require('sharp')

sharp(__dirname + '/background_blue.png')
    .composite([{ input: __dirname + '/skin_blue.png', blend: 'over' }])
    .composite([{ input: __dirname + '/mouth_closed.png', blend: 'over' }])
    .resize(1000, 1000)
    .toFile(__dirname + 'output.png')

Are you able to provide a sample image that helps explain the question?

Bildschirmfoto 2021-03-11 um 16 00 24

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Mar 11, 2021

To avoid compression artefacts, do the PNG conversion earlier. It also looks like you want nearest neighbour interpolation when enlarging.

https://sharp.pixelplumbing.com/api-resize#resize

  const composited = await sharp(__dirname + '/background_blue.jpg')
    .composite([
      { input: __dirname + '/skin_blue.png', blend: 'over' },
      { input: __dirname + '/mouth_closed.png', blend: 'over' }
    ])
+   .png()
    .toBuffer();
  await sharp(composited)
-   .resize(1000, 1000)
+   .resize(1000, 1000, { kernel: 'nearest' })
    .toFile(__dirname + 'output.png')
0reactions
ChristianGriegercommented, Mar 11, 2021

Perfect! Thank you very much 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sharp error: [Error: Input file is missing] - Stack Overflow
I found an issue on the sharp repo which outlines the solution: the request module expects encoding to be set to receive body...
Read more >
toBuffer() throws [Error: Input file is missing] #3009 - GitHub
Running toBuffer() doesn't seem to work and instead throws the error: Are you using the latest version? Is the version currently in use...
Read more >
Error - Input Instance File Missing - BizTalk Server
No input instance message file has been specified, preventing the Validate Instance command from running. ... Right-click the relevant schema file ...
Read more >
Input file contains unsupported image format might be a race ...
Nodejs sharp error - Input file contains unsupported image format might be a race condition. Was doing some S3 work where I had...
Read more >
Avoid the Dynamic tool error if the Input file is not found
hey @IraWatt - thanks for your reply! Unfortunately, the error is related to Dynamic Input not finding the file within the input folder,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found