Bug 961566 - scanimage produces PNM with wrong height in header
scanimage produces PNM with wrong height in header
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: hplip (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tim Waugh
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-09 20:50 EDT by amturnip
Modified: 2015-06-29 07:56 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-06-29 07:56:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Scanned page with header that overstates image data height (67.92 KB, image/x-portable-anymap)
2013-05-09 20:50 EDT, amturnip
no flags Details

  None (edit)
Description amturnip 2013-05-09 20:50:53 EDT
Created attachment 745853 [details]
Scanned page with header that overstates image data height

Description of problem:

scanimage produces pnm files that ImageMagick and gimp cannot read, when scanning from a Hewlett-Packard M1212nf.

I have examined the files and found that the header claims more rows than the image actually has.  Apparently the image is not missing anything. 

If I correct the header, then ImageMagick and gimp can read the corrected file.  

Sample:  I put a document about 11 inches high into the scanner and issue this command:

 $ SANE_DEFAULT_DEVICE="hpaio:/net/HP_LaserJet_Professional_M1212nf_MFP?ip=10.10.159.92" scanimage --source=Flatbed --resolution=75 --format=pnm --mode=Lineart >Putin_glitch.pnm

It yields a 69552-byte file [attached]

 $ stat -c %s Putin_glitch.pnm 
 69552

with the following header

 $ head -3 Putin_glitch.pnm 
 P4
 # SANE data follows
 632 1125

which occupies 32 bytes

 $ head -3 Putin_glitch.pnm | wc -c
 32

leaving an image data size of 69520 bytes.

The width, in bytes, of one row of image should be 632/8=79.

By mathematics, the image height to match the given file would be 880 rows (11.73 inches @ 75dpi).  I cannot explain the extra 0.73 inches but I do not complain about that.

Judging by the header, the data size should be 632 wide x 1125 high @ 1 bit = 711000 bits @ 8 per byte = 88875 bytes.

Examining the file with ImageMagick's `identify` fails:

 $ identify Putin_glitch.pnm 
 identify: unable to read image data `Putin_glitch.pnm' @ error/pnm.c/ReadPNMImage/660.

Nor can gimp read the file.

Now hop into vi and change 1125 to 880; and retry with identify:

 $ identify Putin_glitch.pnm
 Putin_glitch.pnm PBM 632x880 632x880+0+0 1-bit Bilevel DirectClass 69.6KB 0.000u 0:00.009

Also, gimp can read the corrected file.


Version-Release number of selected component (if applicable):

 $ rpm -q sane-backends hplip ImageMagick gimp
 sane-backends-1.0.23-7.fc18.x86_64
 hplip-3.13.3-2.fc18.x86_64
 ImageMagick-6.7.7.5-3.fc18.x86_64
 gimp-2.8.4-1.fc18.x86_64

How reproducible:

Consistently.

Steps to Reproduce: As above
  
Actual results: Header overstates the image height, and applications cannot read the scanned file

Expected results: Scanned file can be read by other tools included in Fedora


Additional info: With a previous HP Officejet 6500, scanimage did not exhibit this problem.
Comment 1 Nils Philippsen 2013-05-15 06:02:02 EDT
I suspect the backend driver (libsane-hpaio) either miscalculating the number of lines in the scan, or alternatively precalculating it and not being able to deliver the complete scan data. Changing component to hplip for examination.
Comment 2 Fedora End Of Life 2013-12-21 08:28:02 EST
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 3 Fedora End Of Life 2014-02-05 16:18:05 EST
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 4 amturnip 2014-02-08 16:16:57 EST
I have reproduced the problem with Fedora 20.  

I scanned a different picture, and again the PNM header promised 1125 rows but the file provided only 880 rows.  As a result, ImageMagick's 'identify' program reported "unable to read image data".  

The incorrect PNM header value, 1125, might assume A4-size paper.  The empirically-determined actual image height, 880, sounds like US Letter paper.
Comment 5 Fedora End Of Life 2015-05-29 05:03:01 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 6 Fedora End Of Life 2015-06-29 07:56:58 EDT
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.