if res > 600: log.warn( "Using resolutions greater than 600 dpi will cause very large files to be created." ) else: log.warn( "The scan current parameters will cause very large files to be created." ) log.warn( "This can cause the scan to take a long time to complete and may cause your system to slow down." ) log.warn("Approx. number of bytes to read from scanner: %s" % utils.format_bytes(scan_size, True)) device.setOption('compression', scanner_compression) if brx - tlx <= 0.0 or bry - tly <= 0.0: log.error("Invalid scan area (width or height is negative).") sys.exit(1) log.info("") log.info("Resolution: %ddpi" % res) log.info("Mode: %s" % scan_mode) log.info("Compression: %s" % scanner_compression) log.info("Scan area (mm):") log.info(" Top left (x,y): (%fmm, %fmm)" % (tlx, tly)) log.info(" Bottom right (x,y): (%fmm, %fmm)" % (brx, bry)) log.info(" Width: %fmm" % (brx - tlx)) log.info(" Height: %fmm" % (bry - tly))
log.error("Failed to get the source from device.") #check if device has only ADF if len(source_option) == 1 and 'ADF' in source_option: log.debug("Device has only ADF support") adf = True if adf: try: if 'ADF' not in source_option: log.error("Failed to set ADF mode. This device doesn't support ADF.") sys.exit(1) else: if duplex == True: if 'Duplex' in source_option: device.setOption("source", "Duplex") else: log.warn("Device doesn't support Duplex scanning. Continuing with Simplex ADF scan.") device.setOption("source", "ADF") else: device.setOption("source", "ADF") device.setOption("batch-scan", True) except scanext.error: log.error("Error in setting ADF mode Duplex=%d." % duplex) sys.exit(1) else: try: device.setOption("source", "Flatbed") device.setOption("batch-scan", False) except scanext.error:
if scan_mode == 'color': scan_size = scan_px * 3 # 3 bytes/px else: scan_size = scan_px # 1 byte/px if scan_size > 52428800: # 50MB if res > 600: log.warn("Using resolutions greater than 600 dpi will cause very large files to be created.") else: log.warn("The scan current parameters will cause very large files to be created.") log.warn("This can cause the scan to take a long time to complete and may cause your system to slow down.") log.warn("Approx. number of bytes to read from scanner: %s" % utils.format_bytes(scan_size, True)) device.setOption('compression', scanner_compression) if brx - tlx <= 0.0 or bry - tly <= 0.0: log.error("Invalid scan area (width or height is negative).") sys.exit(1) log.info("") log.info("Resolution: %ddpi" % res) log.info("Mode: %s" % scan_mode) log.info("Compression: %s" % scanner_compression) log.info("Scan area (mm):") log.info(" Top left (x,y): (%fmm, %fmm)" % (tlx, tly)) log.info(" Bottom right (x,y): (%fmm, %fmm)" % (brx, bry)) log.info(" Width: %fmm" % (brx - tlx)) log.info(" Height: %fmm" % (bry - tly))