You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enhancement: support multiple overlayWith in single pipeline (including blend modes) via vips_composite #728
I'm looking for option to combine multiple images, side by side or one under another.
I looked the overlayWith function but seems it can't do what is required. I also looked in libvips options and maybe .reduce is what we need. Please share with me any idea of realization if there is nothing implemented yet.
Reacted by Spencer Rinehart, Eliseu Monar dos Santos, Benton Anderson, Jannis, Simon Sotak Gregor and Jascha
Hello, if you've not already seen them, a few similar questions are #405#597 and #699
Using the current API, I'd probably suggest looking at #470 (comment) for how to start with a blank canvas. This can then be processed multiple times, each using overlayWith with the relevant values for top and left.
I'm trying to do the same thing. So far the example code on #405 looks the cleanest to me.
However, it creates a new sharp object of the whole thing on each small image that is overlaid over a bigger one. In terms of performance this is impractical for me. Are there any other solutions?
@Etiene The branch referred to in #573 is a WIP and does not yet improve things. The API you propose, although unsupported at present, would make a great future possible enhancement, thank you.
Reacted by Etiene Dalcol, Olli Varis, Geert, SelimGrr, Andy Gray, Param Aggarwal and Sudharsan Tettu
@CWSpear This will require libvips v8.6.0 (sharp v0.19.x). If you're interested in submitting a PR then sharp has a work-in-progress suit branch you can experiment with now.
When I hit localhost:3000/build-image, I only see the image of the bookshelf, but no overlay of the checkmark. When I step through, the sharp object just after composite and before toBuffer() is:
Perfect! Figured it was something simple. For those that read this later, I also had to point pyenv python2 to any appropriate version for the node-gyp to work. In the repo, I ran:
pyenv local 3.6.6 2.7.8
npm install --build-from-source
Activity
lovell commentedon Mar 4, 2017
Hello, if you've not already seen them, a few similar questions are #405 #597 and #699
Using the current API, I'd probably suggest looking at #470 (comment) for how to start with a blank canvas. This can then be processed multiple times, each using
overlayWithwith the relevant values fortopandleft.Etiene commentedon Mar 7, 2017
I'm trying to do the same thing. So far the example code on #405 looks the cleanest to me.
However, it creates a new sharp object of the whole thing on each small image that is overlaid over a bigger one. In terms of performance this is impractical for me. Are there any other solutions?
Thanks
lovell commentedon Mar 7, 2017
Hi @Etiene, your performance concerns may be covered by #573.
Etiene commentedon Mar 7, 2017
Hello @lovell, I installed the branch version, performance is still undoable. Are there any modifications to the code example I need to make?
Is there no way to do something like
?
lovell commentedon Mar 7, 2017
@Etiene The branch referred to in #573 is a WIP and does not yet improve things. The API you propose, although unsupported at present, would make a great future possible enhancement, thank you.
[-]combine multiple images into one[/-][+]Enhancement: support multiple overlayWith in single pipeline[/+]wmertens commentedon Apr 23, 2017
How about, in the meantime, printing a warning when using a second overlayWith in the same pipeline? I was pretty confused when it wasn't working…
Lasto13 commentedon May 8, 2017
This would be great
lovell commentedon May 18, 2017
There's a discussion about adding an image composition operation to the underlying libvips library that will help with this feature request - see https://github.com/jcupitt/libvips/issues/657
CWSpear commentedon Oct 27, 2017
The upstream issue was closed a few weeks ago. Is this unblocked now?
lovell commentedon Oct 28, 2017
@CWSpear This will require libvips v8.6.0 (sharp v0.19.x). If you're interested in submitting a PR then sharp has a work-in-progress
suitbranch you can experiment with now.19 remaining items
lovell commentedon Mar 12, 2019
@jamesvillarrubia This feature is not in v0.21.3 - it is only available in the
uptakebranch - it will be part of the forthcoming v0.22.0.jamesvillarrubia commentedon Mar 13, 2019
Sorry, I was unclear. I’m on the uptake branch and I’m trying to help test it, but I can’t get the composite function to trigger.
lovell commentedon Mar 13, 2019
@jamesvillarrubia Please can you provide a code sample, perhaps as a separate repo/gist, that exhibits this behaviour.
mtbottens commentedon Mar 13, 2019
@lovell
I'm seeing a similar thing. If i pull down the source of this repo, it seems to work, but when using it as a dependency it doesn't seem to work.
Check this out: https://github.com/mtbottens/sharp-composite-example/blob/master/index.js
If you clone down that repo and run
node index.jsit will generate atest.pngfile. I'm seeingactual.pngas a result, whereexpected.pngis the file generated by the unit tests in this repo here: https://github.com/lovell/sharp/blob/uptake/test/unit/composite.js#L69-L77jamesvillarrubia commentedon Mar 13, 2019
Of course! Should have done that to begin with:
https://github.com/jamesvillarrubia/sharp-buffer-rest-api-example/blob/master/app.js
When I hit
localhost:3000/build-image, I only see the image of the bookshelf, but no overlay of the checkmark. When I step through, the sharp object just after composite and beforetoBuffer()is:Details
lovell commentedon Mar 13, 2019
Ah, sorry, you'll need to pass the
--build-from-sourceflag tonpm(I've updated my comment to include this).jamesvillarrubia commentedon Mar 13, 2019
Perfect! Figured it was something simple. For those that read this later, I also had to point pyenv python2 to any appropriate version for the node-gyp to work. In the repo, I ran:
and that solved it!
ovaris commentedon Mar 14, 2019
Hi, testing out the new composite function but for some reason the end result contains only the first image from inputsteam array, here's my code:
So for some reason output image only contains only first image (background).
Any Ideas?
jamesvillarrubia commentedon Mar 14, 2019
You might check out the comment above. I had the same issue - I wasn't using
npm install --build-from-sourcelovell commentedon Mar 19, 2019
v0.22.0 now available with this feature, thanks all for the testing and feedback.
tcz commentedon Mar 26, 2019
This is awesome! Thank you so much for this!
Dramex commentedon Jun 18, 2019
i replaced overlayWith with composite but
cutoutparameters doesn't work.composite([{ input, cutout: true }])lovell commentedon Jun 18, 2019
@Dramex Use
blend: 'dest-in'- there's an example in the readme - https://github.com/lovell/sharp/blob/master/README.md#stream