I've done some more tests with the output from the Umax Astra 610S in
preview-color mode. (sane-0.68)
I worked with a "preview-umax:" file left by xscanimage after a color
preview. (I assume this is close enought to the true output from the
scanner to trust - at least - the bytes order). This of course also work
with the output of "scanimage --preview=yes".
The scanned image is a white paper, with 3 square: RED, GREEN and BLUE,
in order to find RGB signals.
The initial file show a three-column image, each column having the value
for one of the R, G of B signal level.
I first tried to swap bytes (R1R2R3R4...G1G2G3G4...B1B2B3B4... to
R1G1B1R2G2B2R3G3B3R4G4B4...).
This gave a one-column image, but having part of the right side shown on
the left. (ABCD -> DABC), and some strang color change.
I then tried the same swap process but removing some noise at the top.
(about 185 bytes).
This work, showing a properly formated picture (ABCD) but having the
wrong colors. (red shown as blue, green shown as red and blue shown as
green).
I then tried to remove more bytes, keeping the value "~185 in mind. The
correct noise length seems to be LengthOfLineInPixel*2+~185.
With this, we can have some sort of preview image.
But the image also shown some noise at the end, and some missing upper
margin at the top.
I tried to scan a white paper, and find that the noise at the begining
have the same values as the whole image. (form ~240 to 255). I then scan
a black paper, and find that the noise at the begining have again the
same values as the whole image (form 0 to ~32). In short, the "noise" in
not noise, but trailing bytes from a previous line.
At this point, we have to way to go :
- The scanner does not return the first few lines of the image, and we
need to request the image in another way.
- The scanner do return the first few lines, but they are lost/dropped
somewhere.
For now, we are able to convert some "preview-mode" image to something
readable, but with poor quality. (By the way, does anyone know the real
resolution used to do a preview ?)
If someone want to have a look at the quick-and-dirty C program to
convert from bad to better, just ask. It probably needs to be rewritten
to enhance performances, but...
Nicolas.
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com