Don't crop if picture too small
This commit is contained in:
parent
c5d8fbf6e8
commit
43a3c34867
1 changed files with 2 additions and 1 deletions
3
edit.py
3
edit.py
|
@ -66,7 +66,8 @@ class Image:
|
||||||
# center zoom
|
# center zoom
|
||||||
x = self.image.shape[1]/2 - self.w/2
|
x = self.image.shape[1]/2 - self.w/2
|
||||||
y = self.image.shape[0]/2 - self.h/2
|
y = self.image.shape[0]/2 - self.h/2
|
||||||
self.image = self.image[int(y):int(y+self.h), int(x):int(x+self.w)]
|
if x > 0 and y > 0:
|
||||||
|
self.image = self.image[int(y):int(y+self.h), int(x):int(x+self.w)]
|
||||||
|
|
||||||
def safe(self, new_path):
|
def safe(self, new_path):
|
||||||
cv2.imwrite(new_path, self.image)
|
cv2.imwrite(new_path, self.image)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue