How to compose with center gravity in PythonMagick

十年热恋 提交于 2019-12-11 05:14:46

问题


I did appreciate the answer by Orbling on .composite():

flattened.composite(img, 0, 0, PythonMagick.CompositeOperator.SrcOverCompositeOp)

This is the form where the second image is placed to the (0, 0) coordinates of the original image. I tried, but I could not find how the image could be centered to the original.

The internal __doc__ says (formatted manually):

composite( (Image)arg1, 
           (Image)arg2, 
           (GravityType)arg3 
           [, (CompositeOperator)arg4]) -> None :

C++ signature :
    void composite(class Magick::Image {lvalue},
                   class Magick::Image,
                   enum MagickCore::GravityType 
                   [,enum MagickCore::CompositeOperator])

How should I enter the 3rd argument in Python code?


回答1:


(You know, sometimes the answer is obvious when you formulate the question precisely.)

The solution is:

flattened.composite(img, 
                    PythonMagick.GravityType.CenterGravity,            # this
                    PythonMagick.CompositeOperator.SrcOverCompositeOp)


来源:https://stackoverflow.com/questions/20192385/how-to-compose-with-center-gravity-in-pythonmagick

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!