[sane-devel] Re: Unpaper 1.0.1 problem

Jens Gulden mail@jensgulden.de
Sun, 12 Jun 2005 02:56:36 +0200


Janusz S. Bien wrote:
> *** error: Input file format using magic 'P2' is unknown.

PGM and PBM files (generally, PNM files) can be written in two possible 
modes: 'ascii' and 'binary'. (See e.g. 
http://www.csit.fsu.edu/~burkardt/data/pnm/pnm.html)

Unpaper supports BINARY mode only, because this is the default format 
written by scanimage/scanadf, and in most cases one wouldn't want to use 
ascii-mode images anyway. They use up much more space on the disk, and I 
don't see any advantage of them (unless you would want to edit single 
pixels using a text-editor...)

The files you use cannot be loaded by unpaper because they are written 
in ascii-mode. Please try to convert them to binary PBM/PGM first.

>> Both input files has been created with convert from a tif file.

I would expect convert to have an option for chosing between ascii and 
binary mode (but I don't know details about it).
A binary PBM file should start with a byte sequence of 'P4' (called the 
'magic number'), a binary PGM file begins with 'P5'. You should be able 
to find out by opening the file in a text-editor.

Or use Gimp to load and then save-as your files. Gimp will ask you 
whether to use ascii or binary format (at least my version does).

Hope that helps,
Jens


> *** error: Cannot load image 01.pgm.
> 
> When I call
> 
> ./unpaper -vv --layout double 01.pbm unpaper01.pbm
> 
> I get 
> 
> loading file 01.pbm.
> *** error: Input file format using magic 'P1' is unknown.
> *** error: Cannot load image 01.pbm.
> 
> Both input files has been created with convert from a tif file.
> 
> I will appreciate your help.
> 
> Best regards
> 
> Janusz
> 

'