cyanfish / naps2

Scan documents to PDF and more, as simply as possible.
https://www.naps2.com
Other
2.74k stars 321 forks source link

Deskewed PDF file size is much bigger than normal #322

Closed psaletan closed 6 months ago

psaletan commented 7 months ago

Describe the bug When "Deskew scanned pages" post-processing option is enabled in a scan profile, the file size of the scanned PDF is many times larger than when this option is disabled.

This problem occurs in release 7.3.1.0. For example, a black and white one-page scan at 300 dpi is 54 kb without deskew, but 732 kb with deskew enabled. In the 7.2.2 release, there is almost no difference between file sizes (54k vs 52k).

To Reproduce Steps to reproduce the behavior:

  1. Install naps2-7.2.2-linux-x64.deb on Debian 12.
  2. Create a scanner profile for the Canon MX-470 scanner: SANE driver, Paper source = Glass, Bit depth = Black and white, Page size = US Letter, Resolution = 300 dpi. Ensure that "Deskew scanned pages" box ("Advanced" button) is NOT enabled.
  3. Scan a single page on the flatbed.
  4. Observe the file size.
  5. Change the scanner profile by enabling "Deskew scanned pages".
  6. Scan the same page again on the flatbed.
  7. Observe that the file size is approximately the same as the non-deskewed scan.
  8. Install/upgrade to naps2-7.3.1-linux-x64.deb on Debian 12.
  9. Repeat steps 2-7.
  10. Observe that the file size of the deskewed scan is much larger than the non-deskewed scan.

Expected behavior The file sizes should be nearly the same (if the scan does not need much de-skewing).

Screenshots Screenshot_20240306_203034

Desktop (please complete the following information):

Additional context Upon request, I can upload sample PDF's demonstrating the problem.

cyanfish commented 6 months ago

This should be fixed in 7.4.0. (I don't think there's a difference between 7.2.2 and 7.3.1, it would just be related to whether the deskewing actually ended up detecting a rotation).