Closed wiredfool closed 9 years ago
-1
is returned when the driver cannot anticipate the number of lines returned (see section 4.3.8 of http://www.sane-project.org/html/doc012.html). This needs to be handled by dynamically resizing the image as necessary in snap
. I'll look at this as soon as I find a moment.
@hanishkvc Could you please try the overhauled module here https://github.com/manisandro/Sane ?
Fixed in 2.8.0.
Transferred from https://github.com/python-pillow/Pillow/issues/1052
from @hanishkvc
Hi,
I am trying to use python-sane to access a Sane supported Scanner which uses the sane-genesys backend (from the device name), also sane-genesys man page matchs it Ambir PS665.
After init,open,start on doing snap, it fails with a MemoryError in PIL Image. On debugging it further found that basically get_parameters returns a size of (318,-1). And Because of this ysize of -1, PIL Image fails and inturn snap() fails.
As I am not much of a python expert and equally new to sane, for now I have modified sane.py snap code to check if ysize is -1 and then change it to xsize*3. But you all will have a better idea of calculating ysize, maybe using geometry info (I am assuming) or so. So please look at fixing this issue in python-sane by checking if xsize,ysize are valid or not and inturn mapping to some saner calculated value.