[Image-SIG] Sane: Problems in setting color mode

Thomas Renard Thomas.Renard@koeln.de
Fri, 20 Sep 2002 10:54:03 +0200


Hi there,

I created some very simple script for scanning all pictures of a film 
some time ago.

With the newest version of PIL (Imaging-1.1.3) I am not able to set the 
color mode of my Epson 1240U which worked with older versions of PIL.
The following I coded:

import sane

sane.init()

scanner=sane.open('epson:/dev/usb/scanner0')
scanner.mode='Color'

...

But this will create a

Traceback (most recent call last):
  File "./filmscan.py", line 46, in ?
    do_scan(filename, key[:1])
  File "./filmscan.py", line 19, in do_scan
    scanner.mode='Color'
  File "/usr/lib/python2.2/site-packages/PIL/sane.py", line 46, in 
__setattr__
    self.last_opt = dev.set_option(opt.index, value)
_sane.error: Invalid argument

Some additional info:

Debian Woody with python2.1 and 2.2, 2.2 with self created PIL, 2.1 
Debian package python-imaging-sane 1.1.3-1. Sane 1.0.7

Python 2.2.1 (#1, Jul 29 2002, 23:15:49)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sane
 >>> sane.init()
(16777223, 1, 0, 7)
 >>> s=sane.open('epson:/dev/usb/scanner0')
 >>> s.get_parameters()
('L', 1, (424, 584), 1, 53)
 >>> s.get_options()
[(1, None, 'Scan Mode', '', 5, 0, 4, 0, None), (2, 'mode', 'Scan mode', 
'Selects the scan mode (e.g., lineart,monochrome, or color).', 3, 0, 7, 
5, ['Binary', 'Gray', 'Color']), (3, 'depth', 'Bit depth', 'Number of 
bits per sample, typical values are 1 for "line-art" and 8 for multibit 
scans.', 1, 0, 4, 37, [8, 14]), (4, 'halftoning', 'Halftoning', 'Selects 
the halftone.', 3, 0, 26, 5, ['None', 'Halftone A (Hard Tone)', 
'Halftone B (Soft Tone)', 'Halftone C (Net Screen)', 'Dither A (4x4 
Bayer)', 'Dither B (4x4 Spiral)', 'Dither C (4x4 Net Screen)', 'Dither D 
(8x4 Net Screen)', 'Text Enhanced Technology', 'Download pattern A', 
'Download pattern B']), ...

What is done wrong here?

Thomas