-
Notifications
You must be signed in to change notification settings - Fork 24
Getting a very long image in windows #36
Comments
Can you paste the output of list_all.py in a pastebin and post the link here please ? |
Hm, 36600 is far too much. I think your driver is returning a crappy maximum size ... As a workaround, just before you scan, you can try to add something like: pyinsane2.set_scanner_opt(device, 'yextent', [2550 * 2]) # 2 times the max xextend If it does work, I guess I will have to add yet-another-workaround in |
Still getting the same issue, getting following dimensions. Following is my overall script #!/usr/bin/env python3
import os
import sys
import pyinsane2
def main(args):
dstdir = args[0]
devices = pyinsane2.get_devices()
assert(len(devices) > 0)
device = devices[0]
print("Will use the scanner [%s](%s)"
% (str(device), device.name))
pyinsane2.set_scanner_opt(device, "source", ["ADF", "Feeder"])
# Beware: Some scanner have "Lineart" or "Gray" as default mode
pyinsane2.set_scanner_opt(device, "mode", ["Color"])
pyinsane2.set_scanner_opt(device, "resolution", [75])
pyinsane2.set_scanner_opt(device, 'yextent', [2550 * 2]) # 2 times the max xextend
pyinsane2.maximize_scan_area(device)
# Note: If there is no page in the feeder, the behavior of device.scan()
# is not guaranteed : It may raise StopIteration() immediately
# or it may raise it when scan.read() is called
try:
scan_session = device.scan(multiple=True)
print("Scanning ...")
while True:
try:
scan_session.scan.read()
except EOFError:
print("Got page %d" % (len(scan_session.images)))
img = scan_session.images[-1]
imgpath = os.path.join(dstdir, "%d.jpg" %
(len(scan_session.images)))
img.save(imgpath)
except StopIteration:
print("Got %d pages" % len(scan_session.images))
if __name__ == "__main__":
args = sys.argv[1:]
if len(args) <= 0 or args[0][0] == '-':
print("Usage:")
print(" %s <dst directory>" % sys.argv[0])
sys.exit(1)
pyinsane2.init()
try:
main(args)
finally:
pyinsane2.exit() |
|
Thanks it worked, :) Setting the yextent based on the A4 inch size proportions at 1800 for 150 DPI images. |
I'm reopening this ticket. I'll add a workaround in |
While in linux system it the scan_adf.py and scan.py are working fine, but in windows systems the scripts are generating very long images. Please see attachment.
Height of scanned image is 9000 px.
Is there a setting which can be set to correct this issue?
The text was updated successfully, but these errors were encountered: