Open petoor opened 4 years ago
Hi again.
I found i can archive what i try to do with img.embed(0, 0, 3000, 3000) However, the question still stands, i'm not sure why composite changes the number of bands
Hello @petoor,
composite
does fancy alpha compositing using the PDF blend modes (mix, lighten, dodge, etc.), so all the images it combines need to have alpha channels.
https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-composite
If you just want to put one solid image on top of another, try insert
:
result = background.insert(foreground, 100, 100)
https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-insert
There's also join
and embed
(as you've found).
draw_image
will work for any number of bands, but the two images must match, or one must have one band.
https://libvips.github.io/libvips/API/current/libvips-draw.html#vips-draw-image
But ... don't use the draw_
operations! They are just for paint programs, not for image processing. The nip2 paintbox uses them.
Thank you for the clarification :smile:
Are there any benefits (speedup / memory impact) of using insert instead of join or embed?
embed
is the fastest, then insert
, then composite
.
Hi John.
I have some trouble understanding the composite function. Image used in the example : img
The aim here is to have an image of size 3000 x 3000 with cat and black background.
Why does the number of bands change? Another option would be to use draw_image, but that always assumes that the image have 1 or 3 bands which is not always the case.
Best regards