Code: Select all
b'TIFF'
2550x3300
(300.0, 300.0)
12
Traceback (most recent call last):
File "scanfix.py", line 34, in <module>
img.save(view_image)
File "C:\dev\Python31\x86\lib\site-packages\python_magickwand-0.2sickos-py3.1.egg\magickwand\image.py", line 139, in save
self._check_wand_error(api.MagickWriteImage(self._wand, file))
WindowsError: exception: stack overflow
Code: Select all
img = Image(infile)
print(img.format)
print(str(img.width)+'x'+str(img.height))
print(img.resolution)
print(img.compression)
img.deskew()
img.save(view_image)
Code: Select all
def deskew(self):
''' Deskews the image.'''
self._check_wand_error(api.MagickDeskewImage(self._wand,0.1)) # also tried 10.0
def _check_wand_error(self, func):
wand._check_wand_error(self._wand, func)
def save(self, file=None):
''' Saves the image to a file. If no file is specified, the file is
saved with the original filename.'''
self._check_wand_error(api.MagickWriteImage(self._wand, file))
Code: Select all
def _check_wand_error(wand, func):
if not func:
severity = api.ExceptionType()
description = api.MagickGetException(wand, severity)
raise Exception(description)
Code: Select all
MagickDeskewImage = _wandlib.MagickDeskewImage
MagickDeskewImage.restype = MagickBooleanType
MagickDeskewImage.argtypes = [POINTER(MagickWand), c_double]