scanimage and scanadf output different file format. scanadf not readable.
Hi,
I'm trying to build an operation chain from scanning a b/w image until PDF creation of multiple files. I use imagemagick
for conversion between these file formats. Basically, the chain looks easy like this:
scanadf --source=ADF --mode=Lineart --resolution=200 x 210 y 297 -o /home/pi/scan_01.pnm
convert scan_01.pnm scan_01.png
convert scan_01.png scan_01.pdf
Unfortunately, the PNM file returned by scanadf
(first command row) does not seem to be readable by imagemagick
(and not even gimp
) to do the conversion from PNM for PNG. When trying to convert, the command line says:
convert-im6.q16: unable to read image data `scan_01.pnm' @ error/pnm.c/ReadPNMImage/634.
convert-im6.q16: no images defined `scan_01.png' @ error/convert.c/ConvertImageCommand/3258.
The odd thing is that when I replace scanadf
by scanimage
and thus create the PNM file, the conversion using imagemagick's convert function runs fine.
Looking into the HEX dumps of the PNM outputs of scanadf
and scanimage
respectively (scanning the same image and using comparable settings for resolution, size and mode) shows this:
using scanimage
:
00000000: 5034 0a23 2053 414e 4520 6461 7461 2066 P4.# SANE data f
00000010: 6f6c 6c6f 7773 0a31 3635 3320 3233 3338 ollows.1653 2338
00000020: 0a80 0000 0000 0000 0000 0000 0000 0000 ................
using scanadf
:
00000000: 5034 0a23 2053 414e 4520 6461 7461 2066 P4.# SANE data f
00000010: 6f6c 6c6f 7773 0a31 3635 3320 3233 3338 ollows.1653 2338
00000020: 0a00 0000 0000 0000 0000 0000 0000 0000 ................
Showing differences e.g. for the 2nd byte on the 3rd row. I guess, this will be part of the header, which I expected to be equal in both cases.
Does anybody know this effect? Does anybody know how to find a workaround to it? Does anybody know how to convert a b/w scan created by scanadf
into a PNG file?
Thanks in advance.