SANE: incorrect format of B&W image
Way to reproduce:
3 different run using:
lis_set_option(sources[0], OPT_NAME_MODE, OPT_VALUE_MODE_COLOR));
lis_set_option(sources[0], OPT_NAME_MODE, OPT_VALUE_MODE_GRAYSCALE));
lis_set_option(sources[0], OPT_NAME_MODE, OPT_VALUE_MODE_BW));
with no errors.
Scan image, using scan_read
while session->end_of_page(session) != 0
Result:
For all times width is 640. There are 3 buffers with sizes:
Color = 1683840
GrayScale = 1683840
BW = 210480
There is following format for Color and grayscale: pixel = 3 bytes R, G and B.
But there is different format for BW: pixel = 3 BITS. And sometimes there are different bits in triplet.
Expected result:
According to documentation:
scan_read() returns the images as raw 24 pixels (even if scanning in black&white or grayscale).
It would be good both way: change documentation or change behavior.
Additional info:
I can't undestand what the difference between 3 values in B&W case. Result images was builded from different bits offsets [0, 1, 2]
are very similar, but have a lot of differences (16332 different pixels in 640*877 image between 0 and 1 offsets)
Environment:
v@cia-scanstation:~/scan$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
v@cia-scanstation:~/scan$ apt list sane sane-utils libsane-extras
Listing... Done
libsane-extras/bionic,now 1.0.22.5 amd64 [installed]
sane/bionic,now 1.0.14-12build1 amd64 [installed]
sane-utils/bionic-updates,now 1.0.27-1~experimental3ubuntu2.2 amd64 [installed]
Device: Canon i-SENSYS MF3010, id: sane:pixma:04A92759_0165900002C6
libinsane at 0dbc8498ee36532204c787fb83caefeb51f01af1