-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Composite stream #3136
Comments
A sharp instance implements a |
Something like this ?
Which is the right way to init readStream ? If I set const readStream = fs.createReadStream("C:/base.png") I receive error. I'm a beginner in nodes js and express, and I'm hooked |
No success with:
I got:
|
I don't know how correct it is, but I did it with:
As I said, I'm a beginner at Node JS. If it is even more correct than that, please let me know |
If return sharp(base)
.flatten({ background: '#e7e7e7' })
.composite(composite)
.png() |
Thanks a lot for the explanations, it works perfectly. If I want to resize the final picture, adding line
How to proceed? |
Somebody ? |
lovell, can you give me a llitle help here ? |
You'll need to split this into two pipelines: const compositor = sharp(base).composite(composite).png()
const resizer = sharp().resize({ width: 412 })
return compositor.pipe(resizer) |
Thanks, works like a charm... |
I have another question.
and the application fails completely (must be restarted). I tried to catch the error with try and catch, but without success.
How can I prevent this situation? In other words, how can I handle this kind of error? |
Again, lovell, can you give me a llitle help here ? |
If you're using Stream-based output, you'll need to add error handling to those Streams. This is more of a general Node.js question, unrelated to sharp, and suited to a site such as Stack Overflow. As an aside, please don't post "nag" messages asking for updates - there are 3 on this issue alone. |
I understand your point. I had no choice because:
Anyway, thanks again for your answers. And I will try not to stress you too much in the future (I don't promise, I'm just trying). |
I try to do something like this:
HTTP Request -> API ( composite some PNG images from HDD, using Express js and Sharp) -> Response To Request whit one PNG Image
I have server.js :
I have resize.js:
For debug only, write to file is working (but I don't need to write file)
I don't know syntax for last return to respond with finalImage as stream pipe.
The text was updated successfully, but these errors were encountered: