scanimage producing invalid image files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
New
|
Undecided
|
Unassigned |
Bug Description
dgersic@farfalla:~> scanimage -L
device `hpaio:
Hewlett-Packard HP_OfficeJet_
dgersic@farfalla:~> scanimage -T
scanimage: scanning image of size 637x877 pixels at 1
bits/pixel scanimage: acquiring gray frame, 1 bits/sample
scanimage: reading one scanline, 80 bytes... PASS
scanimage: reading one byte... PASS
scanimage: stepped read, 2 bytes... PASS
scanimage: stepped read, 4 bytes... PASS
scanimage: stepped read, 8 bytes... PASS
scanimage: stepped read, 16 bytes... PASS
scanimage: stepped read, 32 bytes... PASS
scanimage: stepped read, 64 bytes... PASS
scanimage: stepped read, 128 bytes... PASS
scanimage: stepped read, 127 bytes... PASS
scanimage: stepped read, 63 bytes... PASS
scanimage: stepped read, 31 bytes... PASS
scanimage: stepped read, 15 bytes... PASS
scanimage: stepped read, 7 bytes... PASS
scanimage: stepped read, 3 bytes... PASS
dgersic@farfalla:~> scanimage -V
scanimage (sane-backends) 1.0.27; backend version 1.0.27
If I scan a page with:
scanimage --format=pnm --mode Color --source ADF --resolution 300 -l 0
-t 0 -x 215.9 -y 279.5
The resuling pnm file seems to be corrupt. Neither ImageMatick convert
nor Gnome's viewer is happy with the file. Gimp will import it, and can
re-save it as a working pnm file (same for PNG and JPG), which then
convert is happy with.
I can provide examples of "bad" and "good" files if that would help.
I dumped a sample pnm file to hex:
00000000 50 36 0a 23 20 53 41 4e 45 20 64 61 74 61 20 66 |P6.# SANE data f|
00000010 6f 6c 6c 6f 77 73 0a 32 35 35 30 20 33 33 30 31 |ollows.2550 3301|
00000020 0a 32 35 35 0a e8 f2 f4 e8 f2 f4 e8 f2 f4 e8 f2 |.255............|
and did some poking around. The math on the file size here (2550 x 3301) doesn't work. There isn't enough data in the file for this. If I take actual file size, divide by 2550, I get 3296. So I hex edited the file to:
00000000 50 36 0a 23 20 53 41 4e 45 20 64 61 74 61 20 66 |P6.# SANE data f|
00000010 6f 6c 6c 6f 77 73 0a 32 35 35 30 20 33 32 39 36 |ollows.2550 3296|
00000020 0a 32 35 35 0a e8 f2 f4 e8 f2 f4 e8 f2 f4 e8 f2 |.255............|
and now convert works fine with it.
Further testing makes it look like the file data is fine, it's the header that is wrong.