Skip to content

composite changes number of bands #183

Open
@petoor

Description

@petoor

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.

>>> img = pyvips.Image.new_from_file("cat.jpg")
>>> black = pyvips.Image.black(3000,3000,bands=img.bands)
>>> together = black.composite(img,"over")
>>> together
<pyvips.Image 3000x3000 uchar, 4 bands, multiband>
>>> img
<pyvips.Image 1024x576 uchar, 3 bands, srgb>
>>> black
<pyvips.Image 3000x3000 uchar, 3 bands, multiband>

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions