only crop with 4 crop points
This commit is contained in:
parent
1ef547f885
commit
0367816257
1 changed files with 11 additions and 10 deletions
|
@ -225,6 +225,7 @@ class Document(models.Model):
|
||||||
if os.path.exists(src):
|
if os.path.exists(src):
|
||||||
if size and page:
|
if size and page:
|
||||||
crop = map(int, page.split(','))
|
crop = map(int, page.split(','))
|
||||||
|
if len(crop) == 4:
|
||||||
path = os.path.join(folder, '%s.jpg' % ','.join(map(str, crop)))
|
path = os.path.join(folder, '%s.jpg' % ','.join(map(str, crop)))
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
img = Image.open(src).crop(crop)
|
img = Image.open(src).crop(crop)
|
||||||
|
|
Loading…
Reference in a new issue