2017-05-19 76 views

回答

1

和Python 库,您需要与library.api模块来实现C-API 。

import ctypes 
from wand.api import library 
from wand.image import Image 

# Define C-API 
library.MagickVignetteImage.argtypes = [ctypes.c_void_p, # Wand 
             ctypes.c_double, # Radius 
             ctypes.c_double, # Sigma 
             ctypes.c_long, # x 
             ctypes.c_long] # y 
# Warning: `x' & `y' are ssize_t. Usually the same size as size_t, or long type. 

# Extent Image class with new method 
class VignetteImage(Image): 
    def vignette(self, radius=0.0, sigma=0.0, offset_x=0, offset_y=0): 
     library.MagickVignetteImage(self.wand, 
            radius, 
            sigma, 
            offset_x, 
            offset_y) 

# Usage 
with VignetteImage(filename="rose:") as rose: 
    rose.vignette(0.0, 5.0) 
    rose.save(filename="RoseVignette.png") 
0

http://www.imagemagick.org/api/magick-image.php#MagickVignetteImage ImageMagick的魔杖文档中

对不起,我不MagickWand或任何其他API代码。我认为你只是找不到vignette的文档。

OOPS!我看到你想要一个不同的魔杖。对不起,我无法帮助。我没有看到任何东西,只是在Wand文档中画图。

你在找什么语言的替代品?你可以直接在ImageMagick中执行(可能是PythonMagick)。

参见OpenCV的,Python和numpy的小插曲在https://www.packtpub.com/mapt/book/application_development/9781785283932/2/ch02lvl1sec25/creating-a-vignette-filter

参见https://github.com/alexjohnson505/image-filter/blob/master/image-filter.py

参见https://imagepy.wordpress.com/2015/11/21/raw-image-processing-in-python-an-example/

相关问题