From 50b40458bccb4535b0bd8bf4ed53129fabe710d0 Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Fri, 15 Aug 2014 14:21:38 +0200 Subject: [PATCH] Add Image.space(). --- pixelocr/image.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pixelocr/image.py b/pixelocr/image.py index ac9ee2c..2d7b6a6 100644 --- a/pixelocr/image.py +++ b/pixelocr/image.py @@ -66,6 +66,11 @@ class Image(object): y = self.y + ystart return Image(self.data[key], x, y) + def space(self, x, y, width, height): + data = np.zeros((height, width, self.shape[2]), dtype=self.data.dtype) + data.fill(255) + return Image(data, x, y) + def _repr_png_(self): buf = BytesIO() imsave(buf, self.data)