Add Image.space().
This commit is contained in:
parent
5f7e6abcb9
commit
50b40458bc
1 changed files with 5 additions and 0 deletions
|
|
@ -66,6 +66,11 @@ class Image(object):
|
||||||
y = self.y + ystart
|
y = self.y + ystart
|
||||||
return Image(self.data[key], x, y)
|
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):
|
def _repr_png_(self):
|
||||||
buf = BytesIO()
|
buf = BytesIO()
|
||||||
imsave(buf, self.data)
|
imsave(buf, self.data)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue