diff --git a/EffectLab/Effect.py b/EffectLab/Effect.py index ad5370b..22114af 100755 --- a/EffectLab/Effect.py +++ b/EffectLab/Effect.py @@ -59,8 +59,19 @@ def filter(self, im): mat = cv.CreateMat(3, 3, cv.CV_32FC1) cv.GetPerspectiveTransform(pos, orig, mat) a = numpy.asarray(mat) - - im = im.transform(im.size, Image.PERSPECTIVE, a.flatten(), Image.BILINEAR) + matrix = a.flatten() + + # fill empty color + data = im.transform(im.size, Image.PERSPECTIVE, matrix, + Image.BILINEAR, 1) + mask = Image.new("L", im.size, 255) + mask = mask.transform(im.size, Image.PERSPECTIVE, matrix, + Image.BILINEAR, 1) + imout = Image.new("RGB", im.size, self.empty_color) + imout.paste(data, mask) + + im = imout + return im