Allow negative coordinates when using an anchor

This commit is contained in:
Matthew Tretter 2012-02-17 22:29:41 -05:00
parent dd5efac0eb
commit 6cca16ef99

View file

@ -128,8 +128,8 @@ class ResizeCanvas(object):
def process(self, img):
new_img = Image.new('RGBA', (self.width, self.height), self.color)
if self.anchor:
x = int(abs(self.width - img.size[0]) * Anchor._ANCHOR_PTS[self.anchor][0])
y = int(abs(self.height - img.size[1]) * Anchor._ANCHOR_PTS[self.anchor][1])
x = int((self.width - img.size[0]) * Anchor._ANCHOR_PTS[self.anchor][0])
y = int((self.height - img.size[1]) * Anchor._ANCHOR_PTS[self.anchor][1])
else:
x, y = self.x, self.y
new_img.paste(img, (x, y))