[sane-devel] 1 bit modes question

mh crapsite at gmx.net
Wed Apr 3 11:25:04 BST 2002


Henning Meier-Geinitz, Dienstag, 2. April 2002 23:20:
> Hi,
>
> Is there any information in the SANE standard how the pixels in 1 bit
> (lineart mode) are ordered? From the current implementations I guess
> it's like in pbm images:
>
>                  111111
> pixel 01234567 89012345
> bit   76543210 76543210
> that means, the first pixels is in the most significant bit.
>
> There are two more insane but allowed modes: 1 bit color (RGB) and 1
> bit color three-pass. From the (partly broken) implementation in
> xscanimage I guess the order is the other way round:
>
> pixel 76543210
> bit   76543210
>
> This would at least be consistant with the distinction between 1 bit gray
> and the other modes for 0 == white / 0 == black.
>
> Any ideas?
>
> If it really isn't in the standard, shouldn't we add a description?

IMHO, you are quite right, the standard actually says nothing about the 
bitorder. For the 1bit gray/lineart mode, it makes sense, that the MSB 
represents the first pixel, since this MSB to LSB order is used by the PBM 
format and this way a frontend can write the image data directly to a PBM 
file.
I don't see a reason, why the bitorder should be reversed for 1bit colormodes 
(i.e. LSB to MSB). On the other hand, it really doesn't matter, because a 
frontend has to access the image data on "bit-level" anyway.

Maybe a description like this one would make sense?

"If depth is 1, every bit represents a pixel. The order of their storage  
within a byte is most significant bit to least significant bit.
If the format is SANE_FRAME_GRAY, 0 is white and 1 is black.
For the other formats,  0 is the minimal, and 1 the maximal value of the red, 
green or blue component." 

Michael



More information about the sane-devel mailing list