Is motion blur missing in wand?
是的,从0.4.3起,wand库中没有实现wand.image.Image.motion_blur方法。在
您需要扩展wand的API以包括^{}。在import ctypes
from wand.image import Image
from wand.api import library
# Tell Python about the C method
library.MagickMotionBlurImage.argtypes = (ctypes.c_void_p, # wand
ctypes.c_double, # radius
ctypes.c_double, # sigma
ctypes.c_double) # angle
# Extend wand.image.Image class to include method signature (remember error handling)
class MyImage(Image):
def motion_blur(self, radius=0.0, sigma=0.0, angle=0.0):
library.MagickMotionBlurImage(self.wand,
radius,
sigma,
angle)
# Example usage
with MyImage(filename='rose:') as img:
img.motion_blur(radius=8.0, sigma=4.0, angle=-57.0)
img.save(filename='rose_motion.png')