[sane-devel] Epson 2450: scanimage produces invalid PNM files

Oliver Rauch oliver.rauch at rauch-domain.de
Sun Apr 14 10:04:29 BST 2002


Roland Roberts wrote:

>     Oliver> 2) there is no 16 bit pnm raw image type defined. So there
>     Oliver>    can be no wrong byte order. xv does read 16 bit raw pnm
>     Oliver>    images in the byte order of the machine (low byte first
>     Oliver>    for ix68).
> 
> The libpnm, libpgm, libppm code expect MSB first.  XSane does the
> right thing by bypassing the raw format and writing plain format.  I
> can find nothing in the pgm/ppm documentation off-hand which documents
> this behavior (MSB first), but I think it wrong to simply decide that
> XV does the right thing when it is incompatible with libpnm.

The pnm format has been extended in april 2000.
As far as I can see there are two interesting new things:
1) 16 bit raw data
2) more than one image in a pnm file

parts of the manual page "pnm" from 08 April 2000:

      - A  raster  of  Width * Height pixels, proceeding through
         the image in normal English reading order.   Each  pixel
         is  a  triplet  of red, green, and blue samples, in that
         order.  Each sample is represented  in  pure  binary  by
         either 1 or 2 bytes.  If the Maxval is less than 256, it
         is 1 byte.  Otherwise, it is 2 bytes.  The most signifi­
         cant byte is first.
...

       Before  April 2000, a raw format PPM file could not have a
       maxval greater than 255.  Hence, it could  not  have  more
       than  one  byte  per  sample.   Old programs may depend on
       this.
 
       Before July 2000, there could be at most one  image  in  a
       PPM  file.   As  a result, most tools to process PPM files
       ignore (and don't read) any data after the first image.

Bye
Oliver


-- 
Homepage:	http://www.rauch-domain.de
sane-umax:	http://www.rauch-domain.de/sane-umax
xsane:		http://www.xsane.org
E-Mail:		mailto:Oliver.Rauch at rauch-domain.de



More information about the sane-devel mailing list