[Python] Unable to recreate python wand composite command in wand which works in imagemagick...

Discussão em 'Python' iniciado por Stack, Março 30, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to composite a small overlay image in middle of screen vertically, but at a fixed position down from top.

    It works fine with imagemagick

    base.png

    over.png

    composite --version
    Version: ImageMagick 6.9.13-12 Q16 x86_64 18420 https://legacy.imagemagick.org
    Copyright: (C) 1999 ImageMagick Studio LLC
    License: https://imagemagick.org/script/license.php
    Features: Cipher DPC Modules OpenMP(4.5)
    Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib


    composite -gravity north -geometry +0+50 over.png base.png output.png


    then it works and i get an image like following

    composite

    However, if i try it in wand, my code looks like

    pip list | grep Wand
    Wand 0.6.13

    def main():
    with Image(filename ="over.png") as o:
    original = o.clone()

    with Image(filename ="base.png") as b:
    base = b.clone()

    base.composite( operator="over", image=original, gravity='north', arguments="+0+50")

    final = base.clone()
    final.save(filename='output.png')



    The geometry in arguments is simply ignored, and the overlay is north, without any offset.

    overlay bad

    i have read extensively the imagemagick, wand documentation and tried to read the wand code, or find examples online of people using it, but i am not clearer why imagemagick is not picking up the geometry arguments.

    Continue reading...

Compartilhe esta Página