Merge pull request #25 from naparuba/master

Master
This commit is contained in:
Alex Yatskov 2015-10-30 11:47:01 +09:00
commit 81bbc5f113

View File

@ -183,7 +183,10 @@ def orientImage(image, size):
# by inverting colors, and asking a bounder box ^^ # by inverting colors, and asking a bounder box ^^
@protect_bad_image @protect_bad_image
def autoCropImage(image): def autoCropImage(image):
try:
x0, y0, xend, yend = ImageChops.invert(image).getbbox() x0, y0, xend, yend = ImageChops.invert(image).getbbox()
except TypeError: # bad image, specific to chops
return image
image = image.crop((x0, y0, xend, yend)) image = image.crop((x0, y0, xend, yend))
return image return image